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 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1657 !surface_->SetBackbufferAllocation(true)) | 1657 !surface_->SetBackbufferAllocation(true)) |
| 1658 return error::kLostContext; | 1658 return error::kLostContext; |
| 1659 return error::kNoError; | 1659 return error::kNoError; |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 void ProcessPendingReadPixels(); | 1662 void ProcessPendingReadPixels(); |
| 1663 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); | 1663 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); |
| 1664 | 1664 |
| 1665 // Generate a member function prototype for each command in an automated and | 1665 // Generate a member function prototype for each command in an automated and |
| 1666 // typesafe way. | 1666 // typesafe way. |
| 1667 #define GLES2_CMD_OP(name) \ | 1667 #define GLES2_CMD_OP(name) \ |
| 1668 Error Handle ## name( \ | 1668 Error Handle##name(uint32 immediate_data_size, const void* data); |
| 1669 uint32 immediate_data_size, \ | |
| 1670 const cmds::name& args); \ | |
| 1671 | 1669 |
| 1672 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 1670 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
| 1673 | 1671 |
| 1674 #undef GLES2_CMD_OP | 1672 #undef GLES2_CMD_OP |
| 1675 | 1673 |
| 1676 // The GL context this decoder renders to on behalf of the client. | 1674 // The GL context this decoder renders to on behalf of the client. |
| 1677 scoped_refptr<gfx::GLSurface> surface_; | 1675 scoped_refptr<gfx::GLSurface> surface_; |
| 1678 scoped_refptr<gfx::GLContext> context_; | 1676 scoped_refptr<gfx::GLContext> context_; |
| 1679 | 1677 |
| 1680 // The ContextGroup for this decoder uses to track resources. | 1678 // The ContextGroup for this decoder uses to track resources. |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3687 if (offscreen_resolved_frame_buffer_.get()) | 3685 if (offscreen_resolved_frame_buffer_.get()) |
| 3688 offscreen_resolved_frame_buffer_->Destroy(); | 3686 offscreen_resolved_frame_buffer_->Destroy(); |
| 3689 if (offscreen_resolved_color_texture_.get()) | 3687 if (offscreen_resolved_color_texture_.get()) |
| 3690 offscreen_resolved_color_texture_->Destroy(); | 3688 offscreen_resolved_color_texture_->Destroy(); |
| 3691 offscreen_resolved_color_texture_.reset(); | 3689 offscreen_resolved_color_texture_.reset(); |
| 3692 offscreen_resolved_frame_buffer_.reset(); | 3690 offscreen_resolved_frame_buffer_.reset(); |
| 3693 | 3691 |
| 3694 return true; | 3692 return true; |
| 3695 } | 3693 } |
| 3696 | 3694 |
| 3697 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( | 3695 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(uint32 immediate_data_size, |
| 3698 uint32 immediate_data_size, const cmds::ResizeCHROMIUM& c) { | 3696 const void* cmd_data) { |
| 3697 const gles2::cmds::ResizeCHROMIUM& c = | |
| 3698 *static_cast<const gles2::cmds::ResizeCHROMIUM*>(cmd_data); | |
| 3699 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) | 3699 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) |
| 3700 return error::kDeferCommandUntilLater; | 3700 return error::kDeferCommandUntilLater; |
| 3701 | 3701 |
| 3702 GLuint width = static_cast<GLuint>(c.width); | 3702 GLuint width = static_cast<GLuint>(c.width); |
| 3703 GLuint height = static_cast<GLuint>(c.height); | 3703 GLuint height = static_cast<GLuint>(c.height); |
| 3704 GLfloat scale_factor = c.scale_factor; | 3704 GLfloat scale_factor = c.scale_factor; |
| 3705 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); | 3705 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); |
| 3706 | 3706 |
| 3707 width = std::max(1U, width); | 3707 width = std::max(1U, width); |
| 3708 height = std::max(1U, height); | 3708 height = std::max(1U, height); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3765 bool doing_gpu_trace = false; | 3765 bool doing_gpu_trace = false; |
| 3766 if (gpu_trace_commands_) { | 3766 if (gpu_trace_commands_) { |
| 3767 if (CMD_FLAG_GET_TRACE_LEVEL(info.cmd_flags) <= gpu_trace_level_) { | 3767 if (CMD_FLAG_GET_TRACE_LEVEL(info.cmd_flags) <= gpu_trace_level_) { |
| 3768 doing_gpu_trace = true; | 3768 doing_gpu_trace = true; |
| 3769 gpu_tracer_->Begin(GetCommandName(command), kTraceDecoder); | 3769 gpu_tracer_->Begin(GetCommandName(command), kTraceDecoder); |
| 3770 } | 3770 } |
| 3771 } | 3771 } |
| 3772 | 3772 |
| 3773 uint32 immediate_data_size = | 3773 uint32 immediate_data_size = |
| 3774 (arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT | 3774 (arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT |
| 3775 switch (command) { | |
| 3776 #define GLES2_CMD_OP(name) \ | |
| 3777 case cmds::name::kCmdId: \ | |
| 3778 result = Handle ## name( \ | |
| 3779 immediate_data_size, \ | |
| 3780 *static_cast<const gles2::cmds::name*>(cmd_data)); \ | |
| 3781 break; \ | |
| 3782 | 3775 |
| 3783 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 3776 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( |
| 3784 #undef GLES2_CMD_OP | 3777 uint32 immediate_data_size, const void* data); |
| 3785 } | 3778 |
| 3779 static CmdHandler cmd_handlers[] = { | |
|
piman
2014/09/05 22:10:16
nit: can we fold this into g_command_info? It seem
vmiura
2014/09/05 22:35:44
Done.
| |
| 3780 #define GLES2_CMD_OP(name) &GLES2DecoderImpl::Handle##name, | |
| 3781 GLES2_COMMAND_LIST(GLES2_CMD_OP) | |
| 3782 #undef GLES2_CMD_OP | |
| 3783 }; | |
| 3784 | |
| 3785 result = | |
| 3786 (this->*cmd_handlers[command_index])(immediate_data_size, cmd_data); | |
| 3786 | 3787 |
| 3787 if (doing_gpu_trace) | 3788 if (doing_gpu_trace) |
| 3788 gpu_tracer_->End(kTraceDecoder); | 3789 gpu_tracer_->End(kTraceDecoder); |
| 3789 | 3790 |
| 3790 if (debug()) { | 3791 if (debug()) { |
| 3791 GLenum error; | 3792 GLenum error; |
| 3792 while ((error = glGetError()) != GL_NO_ERROR) { | 3793 while ((error = glGetError()) != GL_NO_ERROR) { |
| 3793 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "] " | 3794 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "] " |
| 3794 << "GL ERROR: " << GLES2Util::GetStringEnum(error) << " : " | 3795 << "GL ERROR: " << GLES2Util::GetStringEnum(error) << " : " |
| 3795 << GetCommandName(command); | 3796 << GetCommandName(command); |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4801 Program* program = GetProgramInfoNotShader( | 4802 Program* program = GetProgramInfoNotShader( |
| 4802 program_id, "glBindAttribLocation"); | 4803 program_id, "glBindAttribLocation"); |
| 4803 if (!program) { | 4804 if (!program) { |
| 4804 return; | 4805 return; |
| 4805 } | 4806 } |
| 4806 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); | 4807 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); |
| 4807 glBindAttribLocation(program->service_id(), index, name); | 4808 glBindAttribLocation(program->service_id(), index, name); |
| 4808 } | 4809 } |
| 4809 | 4810 |
| 4810 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( | 4811 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( |
| 4811 uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) { | 4812 uint32 immediate_data_size, |
| 4813 const void* cmd_data) { | |
| 4814 const gles2::cmds::BindAttribLocationBucket& c = | |
| 4815 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); | |
| 4812 GLuint program = static_cast<GLuint>(c.program); | 4816 GLuint program = static_cast<GLuint>(c.program); |
| 4813 GLuint index = static_cast<GLuint>(c.index); | 4817 GLuint index = static_cast<GLuint>(c.index); |
| 4814 Bucket* bucket = GetBucket(c.name_bucket_id); | 4818 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 4815 if (!bucket || bucket->size() == 0) { | 4819 if (!bucket || bucket->size() == 0) { |
| 4816 return error::kInvalidArguments; | 4820 return error::kInvalidArguments; |
| 4817 } | 4821 } |
| 4818 std::string name_str; | 4822 std::string name_str; |
| 4819 if (!bucket->GetAsString(&name_str)) { | 4823 if (!bucket->GetAsString(&name_str)) { |
| 4820 return error::kInvalidArguments; | 4824 return error::kInvalidArguments; |
| 4821 } | 4825 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 4852 } | 4856 } |
| 4853 if (!program->SetUniformLocationBinding(name, location)) { | 4857 if (!program->SetUniformLocationBinding(name, location)) { |
| 4854 LOCAL_SET_GL_ERROR( | 4858 LOCAL_SET_GL_ERROR( |
| 4855 GL_INVALID_VALUE, | 4859 GL_INVALID_VALUE, |
| 4856 "glBindUniformLocationCHROMIUM", "location out of range"); | 4860 "glBindUniformLocationCHROMIUM", "location out of range"); |
| 4857 } | 4861 } |
| 4858 } | 4862 } |
| 4859 | 4863 |
| 4860 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( | 4864 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( |
| 4861 uint32 immediate_data_size, | 4865 uint32 immediate_data_size, |
| 4862 const cmds::BindUniformLocationCHROMIUMBucket& c) { | 4866 const void* cmd_data) { |
| 4867 const gles2::cmds::BindUniformLocationCHROMIUMBucket& c = | |
| 4868 *static_cast<const gles2::cmds::BindUniformLocationCHROMIUMBucket*>( | |
| 4869 cmd_data); | |
| 4863 GLuint program = static_cast<GLuint>(c.program); | 4870 GLuint program = static_cast<GLuint>(c.program); |
| 4864 GLint location = static_cast<GLint>(c.location); | 4871 GLint location = static_cast<GLint>(c.location); |
| 4865 Bucket* bucket = GetBucket(c.name_bucket_id); | 4872 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 4866 if (!bucket || bucket->size() == 0) { | 4873 if (!bucket || bucket->size() == 0) { |
| 4867 return error::kInvalidArguments; | 4874 return error::kInvalidArguments; |
| 4868 } | 4875 } |
| 4869 std::string name_str; | 4876 std::string name_str; |
| 4870 if (!bucket->GetAsString(&name_str)) { | 4877 if (!bucket->GetAsString(&name_str)) { |
| 4871 return error::kInvalidArguments; | 4878 return error::kInvalidArguments; |
| 4872 } | 4879 } |
| 4873 DoBindUniformLocationCHROMIUM(program, location, name_str.c_str()); | 4880 DoBindUniformLocationCHROMIUM(program, location, name_str.c_str()); |
| 4874 return error::kNoError; | 4881 return error::kNoError; |
| 4875 } | 4882 } |
| 4876 | 4883 |
| 4877 error::Error GLES2DecoderImpl::HandleDeleteShader( | 4884 error::Error GLES2DecoderImpl::HandleDeleteShader(uint32 immediate_data_size, |
| 4878 uint32 immediate_data_size, const cmds::DeleteShader& c) { | 4885 const void* cmd_data) { |
| 4886 const gles2::cmds::DeleteShader& c = | |
| 4887 *static_cast<const gles2::cmds::DeleteShader*>(cmd_data); | |
| 4879 GLuint client_id = c.shader; | 4888 GLuint client_id = c.shader; |
| 4880 if (client_id) { | 4889 if (client_id) { |
| 4881 Shader* shader = GetShader(client_id); | 4890 Shader* shader = GetShader(client_id); |
| 4882 if (shader) { | 4891 if (shader) { |
| 4883 if (!shader->IsDeleted()) { | 4892 if (!shader->IsDeleted()) { |
| 4884 glDeleteShader(shader->service_id()); | 4893 glDeleteShader(shader->service_id()); |
| 4885 shader_manager()->MarkAsDeleted(shader); | 4894 shader_manager()->MarkAsDeleted(shader); |
| 4886 } | 4895 } |
| 4887 } else { | 4896 } else { |
| 4888 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader"); | 4897 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader"); |
| 4889 } | 4898 } |
| 4890 } | 4899 } |
| 4891 return error::kNoError; | 4900 return error::kNoError; |
| 4892 } | 4901 } |
| 4893 | 4902 |
| 4894 error::Error GLES2DecoderImpl::HandleDeleteProgram( | 4903 error::Error GLES2DecoderImpl::HandleDeleteProgram(uint32 immediate_data_size, |
| 4895 uint32 immediate_data_size, const cmds::DeleteProgram& c) { | 4904 const void* cmd_data) { |
| 4905 const gles2::cmds::DeleteProgram& c = | |
| 4906 *static_cast<const gles2::cmds::DeleteProgram*>(cmd_data); | |
| 4896 GLuint client_id = c.program; | 4907 GLuint client_id = c.program; |
| 4897 if (client_id) { | 4908 if (client_id) { |
| 4898 Program* program = GetProgram(client_id); | 4909 Program* program = GetProgram(client_id); |
| 4899 if (program) { | 4910 if (program) { |
| 4900 if (!program->IsDeleted()) { | 4911 if (!program->IsDeleted()) { |
| 4901 program_manager()->MarkAsDeleted(shader_manager(), program); | 4912 program_manager()->MarkAsDeleted(shader_manager(), program); |
| 4902 } | 4913 } |
| 4903 } else { | 4914 } else { |
| 4904 LOCAL_SET_GL_ERROR( | 4915 LOCAL_SET_GL_ERROR( |
| 4905 GL_INVALID_VALUE, "glDeleteProgram", "unknown program"); | 4916 GL_INVALID_VALUE, "glDeleteProgram", "unknown program"); |
| 4906 } | 4917 } |
| 4907 } | 4918 } |
| 4908 return error::kNoError; | 4919 return error::kNoError; |
| 4909 } | 4920 } |
| 4910 | 4921 |
| 4911 void GLES2DecoderImpl::DoDeleteSharedIdsCHROMIUM( | 4922 void GLES2DecoderImpl::DoDeleteSharedIdsCHROMIUM( |
| 4912 GLuint namespace_id, GLsizei n, const GLuint* ids) { | 4923 GLuint namespace_id, GLsizei n, const GLuint* ids) { |
| 4913 IdAllocatorInterface* id_allocator = group_->GetIdAllocator(namespace_id); | 4924 IdAllocatorInterface* id_allocator = group_->GetIdAllocator(namespace_id); |
| 4914 for (GLsizei ii = 0; ii < n; ++ii) { | 4925 for (GLsizei ii = 0; ii < n; ++ii) { |
| 4915 id_allocator->FreeID(ids[ii]); | 4926 id_allocator->FreeID(ids[ii]); |
| 4916 } | 4927 } |
| 4917 } | 4928 } |
| 4918 | 4929 |
| 4919 error::Error GLES2DecoderImpl::HandleDeleteSharedIdsCHROMIUM( | 4930 error::Error GLES2DecoderImpl::HandleDeleteSharedIdsCHROMIUM( |
| 4920 uint32 immediate_data_size, const cmds::DeleteSharedIdsCHROMIUM& c) { | 4931 uint32 immediate_data_size, |
| 4932 const void* cmd_data) { | |
| 4933 const gles2::cmds::DeleteSharedIdsCHROMIUM& c = | |
| 4934 *static_cast<const gles2::cmds::DeleteSharedIdsCHROMIUM*>(cmd_data); | |
| 4921 GLuint namespace_id = static_cast<GLuint>(c.namespace_id); | 4935 GLuint namespace_id = static_cast<GLuint>(c.namespace_id); |
| 4922 GLsizei n = static_cast<GLsizei>(c.n); | 4936 GLsizei n = static_cast<GLsizei>(c.n); |
| 4923 uint32 data_size; | 4937 uint32 data_size; |
| 4924 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 4938 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
| 4925 return error::kOutOfBounds; | 4939 return error::kOutOfBounds; |
| 4926 } | 4940 } |
| 4927 const GLuint* ids = GetSharedMemoryAs<const GLuint*>( | 4941 const GLuint* ids = GetSharedMemoryAs<const GLuint*>( |
| 4928 c.ids_shm_id, c.ids_shm_offset, data_size); | 4942 c.ids_shm_id, c.ids_shm_offset, data_size); |
| 4929 if (n < 0) { | 4943 if (n < 0) { |
| 4930 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "DeleteSharedIdsCHROMIUM", "n < 0"); | 4944 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "DeleteSharedIdsCHROMIUM", "n < 0"); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 4946 } | 4960 } |
| 4947 } else { | 4961 } else { |
| 4948 for (GLsizei ii = 0; ii < n; ++ii) { | 4962 for (GLsizei ii = 0; ii < n; ++ii) { |
| 4949 ids[ii] = id_allocator->AllocateIDAtOrAbove(id_offset); | 4963 ids[ii] = id_allocator->AllocateIDAtOrAbove(id_offset); |
| 4950 id_offset = ids[ii] + 1; | 4964 id_offset = ids[ii] + 1; |
| 4951 } | 4965 } |
| 4952 } | 4966 } |
| 4953 } | 4967 } |
| 4954 | 4968 |
| 4955 error::Error GLES2DecoderImpl::HandleGenSharedIdsCHROMIUM( | 4969 error::Error GLES2DecoderImpl::HandleGenSharedIdsCHROMIUM( |
| 4956 uint32 immediate_data_size, const cmds::GenSharedIdsCHROMIUM& c) { | 4970 uint32 immediate_data_size, |
| 4971 const void* cmd_data) { | |
| 4972 const gles2::cmds::GenSharedIdsCHROMIUM& c = | |
| 4973 *static_cast<const gles2::cmds::GenSharedIdsCHROMIUM*>(cmd_data); | |
| 4957 GLuint namespace_id = static_cast<GLuint>(c.namespace_id); | 4974 GLuint namespace_id = static_cast<GLuint>(c.namespace_id); |
| 4958 GLuint id_offset = static_cast<GLuint>(c.id_offset); | 4975 GLuint id_offset = static_cast<GLuint>(c.id_offset); |
| 4959 GLsizei n = static_cast<GLsizei>(c.n); | 4976 GLsizei n = static_cast<GLsizei>(c.n); |
| 4960 uint32 data_size; | 4977 uint32 data_size; |
| 4961 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 4978 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
| 4962 return error::kOutOfBounds; | 4979 return error::kOutOfBounds; |
| 4963 } | 4980 } |
| 4964 GLuint* ids = GetSharedMemoryAs<GLuint*>( | 4981 GLuint* ids = GetSharedMemoryAs<GLuint*>( |
| 4965 c.ids_shm_id, c.ids_shm_offset, data_size); | 4982 c.ids_shm_id, c.ids_shm_offset, data_size); |
| 4966 if (n < 0) { | 4983 if (n < 0) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 4984 } | 5001 } |
| 4985 LOCAL_SET_GL_ERROR( | 5002 LOCAL_SET_GL_ERROR( |
| 4986 GL_INVALID_VALUE, "RegisterSharedIdsCHROMIUM", | 5003 GL_INVALID_VALUE, "RegisterSharedIdsCHROMIUM", |
| 4987 "attempt to register id that already exists"); | 5004 "attempt to register id that already exists"); |
| 4988 return; | 5005 return; |
| 4989 } | 5006 } |
| 4990 } | 5007 } |
| 4991 } | 5008 } |
| 4992 | 5009 |
| 4993 error::Error GLES2DecoderImpl::HandleRegisterSharedIdsCHROMIUM( | 5010 error::Error GLES2DecoderImpl::HandleRegisterSharedIdsCHROMIUM( |
| 4994 uint32 immediate_data_size, const cmds::RegisterSharedIdsCHROMIUM& c) { | 5011 uint32 immediate_data_size, |
| 5012 const void* cmd_data) { | |
| 5013 const gles2::cmds::RegisterSharedIdsCHROMIUM& c = | |
| 5014 *static_cast<const gles2::cmds::RegisterSharedIdsCHROMIUM*>(cmd_data); | |
| 4995 GLuint namespace_id = static_cast<GLuint>(c.namespace_id); | 5015 GLuint namespace_id = static_cast<GLuint>(c.namespace_id); |
| 4996 GLsizei n = static_cast<GLsizei>(c.n); | 5016 GLsizei n = static_cast<GLsizei>(c.n); |
| 4997 uint32 data_size; | 5017 uint32 data_size; |
| 4998 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 5018 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
| 4999 return error::kOutOfBounds; | 5019 return error::kOutOfBounds; |
| 5000 } | 5020 } |
| 5001 GLuint* ids = GetSharedMemoryAs<GLuint*>( | 5021 GLuint* ids = GetSharedMemoryAs<GLuint*>( |
| 5002 c.ids_shm_id, c.ids_shm_offset, data_size); | 5022 c.ids_shm_id, c.ids_shm_offset, data_size); |
| 5003 if (n < 0) { | 5023 if (n < 0) { |
| 5004 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "RegisterSharedIdsCHROMIUM", "n < 0"); | 5024 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "RegisterSharedIdsCHROMIUM", "n < 0"); |
| (...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6558 // We don't have to restore attrib 0 generic data at the end of this | 6578 // We don't have to restore attrib 0 generic data at the end of this |
| 6559 // function even if it is simulated. This is because we will simulate | 6579 // function even if it is simulated. This is because we will simulate |
| 6560 // it in each draw call, and attrib 0 generic data queries use cached | 6580 // it in each draw call, and attrib 0 generic data queries use cached |
| 6561 // values instead of passing down to the underlying driver. | 6581 // values instead of passing down to the underlying driver. |
| 6562 RestoreStateForAttrib(0, false); | 6582 RestoreStateForAttrib(0, false); |
| 6563 } | 6583 } |
| 6564 } | 6584 } |
| 6565 return error::kNoError; | 6585 return error::kNoError; |
| 6566 } | 6586 } |
| 6567 | 6587 |
| 6568 error::Error GLES2DecoderImpl::HandleDrawArrays( | 6588 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32 immediate_data_size, |
| 6569 uint32 immediate_data_size, const cmds::DrawArrays& c) { | 6589 const void* cmd_data) { |
| 6590 const cmds::DrawArrays& c = *static_cast<const cmds::DrawArrays*>(cmd_data); | |
| 6570 return DoDrawArrays("glDrawArrays", | 6591 return DoDrawArrays("glDrawArrays", |
| 6571 false, | 6592 false, |
| 6572 static_cast<GLenum>(c.mode), | 6593 static_cast<GLenum>(c.mode), |
| 6573 static_cast<GLint>(c.first), | 6594 static_cast<GLint>(c.first), |
| 6574 static_cast<GLsizei>(c.count), | 6595 static_cast<GLsizei>(c.count), |
| 6575 1); | 6596 1); |
| 6576 } | 6597 } |
| 6577 | 6598 |
| 6578 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( | 6599 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( |
| 6579 uint32 immediate_data_size, const cmds::DrawArraysInstancedANGLE& c) { | 6600 uint32 immediate_data_size, |
| 6601 const void* cmd_data) { | |
| 6602 const gles2::cmds::DrawArraysInstancedANGLE& c = | |
| 6603 *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); | |
| 6580 if (!features().angle_instanced_arrays) { | 6604 if (!features().angle_instanced_arrays) { |
| 6581 LOCAL_SET_GL_ERROR( | 6605 LOCAL_SET_GL_ERROR( |
| 6582 GL_INVALID_OPERATION, | 6606 GL_INVALID_OPERATION, |
| 6583 "glDrawArraysInstancedANGLE", "function not available"); | 6607 "glDrawArraysInstancedANGLE", "function not available"); |
| 6584 return error::kNoError; | 6608 return error::kNoError; |
| 6585 } | 6609 } |
| 6586 return DoDrawArrays("glDrawArraysIntancedANGLE", | 6610 return DoDrawArrays("glDrawArraysIntancedANGLE", |
| 6587 true, | 6611 true, |
| 6588 static_cast<GLenum>(c.mode), | 6612 static_cast<GLenum>(c.mode), |
| 6589 static_cast<GLint>(c.first), | 6613 static_cast<GLint>(c.first), |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6697 // We don't have to restore attrib 0 generic data at the end of this | 6721 // We don't have to restore attrib 0 generic data at the end of this |
| 6698 // function even if it is simulated. This is because we will simulate | 6722 // function even if it is simulated. This is because we will simulate |
| 6699 // it in each draw call, and attrib 0 generic data queries use cached | 6723 // it in each draw call, and attrib 0 generic data queries use cached |
| 6700 // values instead of passing down to the underlying driver. | 6724 // values instead of passing down to the underlying driver. |
| 6701 RestoreStateForAttrib(0, false); | 6725 RestoreStateForAttrib(0, false); |
| 6702 } | 6726 } |
| 6703 } | 6727 } |
| 6704 return error::kNoError; | 6728 return error::kNoError; |
| 6705 } | 6729 } |
| 6706 | 6730 |
| 6707 error::Error GLES2DecoderImpl::HandleDrawElements( | 6731 error::Error GLES2DecoderImpl::HandleDrawElements(uint32 immediate_data_size, |
| 6708 uint32 immediate_data_size, const cmds::DrawElements& c) { | 6732 const void* cmd_data) { |
| 6733 const gles2::cmds::DrawElements& c = | |
| 6734 *static_cast<const gles2::cmds::DrawElements*>(cmd_data); | |
| 6709 return DoDrawElements("glDrawElements", | 6735 return DoDrawElements("glDrawElements", |
| 6710 false, | 6736 false, |
| 6711 static_cast<GLenum>(c.mode), | 6737 static_cast<GLenum>(c.mode), |
| 6712 static_cast<GLsizei>(c.count), | 6738 static_cast<GLsizei>(c.count), |
| 6713 static_cast<GLenum>(c.type), | 6739 static_cast<GLenum>(c.type), |
| 6714 static_cast<int32>(c.index_offset), | 6740 static_cast<int32>(c.index_offset), |
| 6715 1); | 6741 1); |
| 6716 } | 6742 } |
| 6717 | 6743 |
| 6718 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( | 6744 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( |
| 6719 uint32 immediate_data_size, const cmds::DrawElementsInstancedANGLE& c) { | 6745 uint32 immediate_data_size, |
| 6746 const void* cmd_data) { | |
| 6747 const gles2::cmds::DrawElementsInstancedANGLE& c = | |
| 6748 *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); | |
| 6720 if (!features().angle_instanced_arrays) { | 6749 if (!features().angle_instanced_arrays) { |
| 6721 LOCAL_SET_GL_ERROR( | 6750 LOCAL_SET_GL_ERROR( |
| 6722 GL_INVALID_OPERATION, | 6751 GL_INVALID_OPERATION, |
| 6723 "glDrawElementsInstancedANGLE", "function not available"); | 6752 "glDrawElementsInstancedANGLE", "function not available"); |
| 6724 return error::kNoError; | 6753 return error::kNoError; |
| 6725 } | 6754 } |
| 6726 return DoDrawElements("glDrawElementsInstancedANGLE", | 6755 return DoDrawElements("glDrawElementsInstancedANGLE", |
| 6727 true, | 6756 true, |
| 6728 static_cast<GLenum>(c.mode), | 6757 static_cast<GLenum>(c.mode), |
| 6729 static_cast<GLsizei>(c.count), | 6758 static_cast<GLsizei>(c.count), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6763 if (!shader) { | 6792 if (!shader) { |
| 6764 return error::kNoError; | 6793 return error::kNoError; |
| 6765 } | 6794 } |
| 6766 // Note: We don't actually call glShaderSource here. We wait until | 6795 // Note: We don't actually call glShaderSource here. We wait until |
| 6767 // the call to glCompileShader. | 6796 // the call to glCompileShader. |
| 6768 shader->UpdateSource(str.c_str()); | 6797 shader->UpdateSource(str.c_str()); |
| 6769 return error::kNoError; | 6798 return error::kNoError; |
| 6770 } | 6799 } |
| 6771 | 6800 |
| 6772 error::Error GLES2DecoderImpl::HandleShaderSourceBucket( | 6801 error::Error GLES2DecoderImpl::HandleShaderSourceBucket( |
| 6773 uint32 immediate_data_size, const cmds::ShaderSourceBucket& c) { | 6802 uint32 immediate_data_size, |
| 6803 const void* cmd_data) { | |
| 6804 const gles2::cmds::ShaderSourceBucket& c = | |
| 6805 *static_cast<const gles2::cmds::ShaderSourceBucket*>(cmd_data); | |
| 6774 Bucket* bucket = GetBucket(c.data_bucket_id); | 6806 Bucket* bucket = GetBucket(c.data_bucket_id); |
| 6775 if (!bucket || bucket->size() == 0) { | 6807 if (!bucket || bucket->size() == 0) { |
| 6776 return error::kInvalidArguments; | 6808 return error::kInvalidArguments; |
| 6777 } | 6809 } |
| 6778 return ShaderSourceHelper( | 6810 return ShaderSourceHelper( |
| 6779 c.shader, bucket->GetDataAs<const char*>(0, bucket->size() - 1), | 6811 c.shader, bucket->GetDataAs<const char*>(0, bucket->size() - 1), |
| 6780 bucket->size() - 1); | 6812 bucket->size() - 1); |
| 6781 } | 6813 } |
| 6782 | 6814 |
| 6783 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { | 6815 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6818 case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: | 6850 case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 6819 *params = shader->translated_source() ? | 6851 *params = shader->translated_source() ? |
| 6820 shader->translated_source()->size() + 1 : 0; | 6852 shader->translated_source()->size() + 1 : 0; |
| 6821 return; | 6853 return; |
| 6822 default: | 6854 default: |
| 6823 break; | 6855 break; |
| 6824 } | 6856 } |
| 6825 glGetShaderiv(shader->service_id(), pname, params); | 6857 glGetShaderiv(shader->service_id(), pname, params); |
| 6826 } | 6858 } |
| 6827 | 6859 |
| 6828 error::Error GLES2DecoderImpl::HandleGetShaderSource( | 6860 error::Error GLES2DecoderImpl::HandleGetShaderSource(uint32 immediate_data_size, |
| 6829 uint32 immediate_data_size, const cmds::GetShaderSource& c) { | 6861 const void* cmd_data) { |
| 6862 const gles2::cmds::GetShaderSource& c = | |
| 6863 *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); | |
| 6830 GLuint shader_id = c.shader; | 6864 GLuint shader_id = c.shader; |
| 6831 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 6865 uint32 bucket_id = static_cast<uint32>(c.bucket_id); |
| 6832 Bucket* bucket = CreateBucket(bucket_id); | 6866 Bucket* bucket = CreateBucket(bucket_id); |
| 6833 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); | 6867 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); |
| 6834 if (!shader || !shader->source()) { | 6868 if (!shader || !shader->source()) { |
| 6835 bucket->SetSize(0); | 6869 bucket->SetSize(0); |
| 6836 return error::kNoError; | 6870 return error::kNoError; |
| 6837 } | 6871 } |
| 6838 bucket->SetFromString(shader->source()->c_str()); | 6872 bucket->SetFromString(shader->source()->c_str()); |
| 6839 return error::kNoError; | 6873 return error::kNoError; |
| 6840 } | 6874 } |
| 6841 | 6875 |
| 6842 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( | 6876 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( |
| 6843 uint32 immediate_data_size, | 6877 uint32 immediate_data_size, |
| 6844 const cmds::GetTranslatedShaderSourceANGLE& c) { | 6878 const void* cmd_data) { |
| 6879 const gles2::cmds::GetTranslatedShaderSourceANGLE& c = | |
| 6880 *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( | |
| 6881 cmd_data); | |
| 6845 GLuint shader_id = c.shader; | 6882 GLuint shader_id = c.shader; |
| 6846 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 6883 uint32 bucket_id = static_cast<uint32>(c.bucket_id); |
| 6847 Bucket* bucket = CreateBucket(bucket_id); | 6884 Bucket* bucket = CreateBucket(bucket_id); |
| 6848 Shader* shader = GetShaderInfoNotProgram( | 6885 Shader* shader = GetShaderInfoNotProgram( |
| 6849 shader_id, "glGetTranslatedShaderSourceANGLE"); | 6886 shader_id, "glGetTranslatedShaderSourceANGLE"); |
| 6850 if (!shader) { | 6887 if (!shader) { |
| 6851 bucket->SetSize(0); | 6888 bucket->SetSize(0); |
| 6852 return error::kNoError; | 6889 return error::kNoError; |
| 6853 } | 6890 } |
| 6854 | 6891 |
| 6855 bucket->SetFromString(shader->translated_source() ? | 6892 bucket->SetFromString(shader->translated_source() ? |
| 6856 shader->translated_source()->c_str() : NULL); | 6893 shader->translated_source()->c_str() : NULL); |
| 6857 return error::kNoError; | 6894 return error::kNoError; |
| 6858 } | 6895 } |
| 6859 | 6896 |
| 6860 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( | 6897 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( |
| 6861 uint32 immediate_data_size, const cmds::GetProgramInfoLog& c) { | 6898 uint32 immediate_data_size, |
| 6899 const void* cmd_data) { | |
| 6900 const gles2::cmds::GetProgramInfoLog& c = | |
| 6901 *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); | |
| 6862 GLuint program_id = c.program; | 6902 GLuint program_id = c.program; |
| 6863 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 6903 uint32 bucket_id = static_cast<uint32>(c.bucket_id); |
| 6864 Bucket* bucket = CreateBucket(bucket_id); | 6904 Bucket* bucket = CreateBucket(bucket_id); |
| 6865 Program* program = GetProgramInfoNotShader( | 6905 Program* program = GetProgramInfoNotShader( |
| 6866 program_id, "glGetProgramInfoLog"); | 6906 program_id, "glGetProgramInfoLog"); |
| 6867 if (!program || !program->log_info()) { | 6907 if (!program || !program->log_info()) { |
| 6868 bucket->SetFromString(""); | 6908 bucket->SetFromString(""); |
| 6869 return error::kNoError; | 6909 return error::kNoError; |
| 6870 } | 6910 } |
| 6871 bucket->SetFromString(program->log_info()->c_str()); | 6911 bucket->SetFromString(program->log_info()->c_str()); |
| 6872 return error::kNoError; | 6912 return error::kNoError; |
| 6873 } | 6913 } |
| 6874 | 6914 |
| 6875 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( | 6915 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( |
| 6876 uint32 immediate_data_size, const cmds::GetShaderInfoLog& c) { | 6916 uint32 immediate_data_size, |
| 6917 const void* cmd_data) { | |
| 6918 const gles2::cmds::GetShaderInfoLog& c = | |
| 6919 *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); | |
| 6877 GLuint shader_id = c.shader; | 6920 GLuint shader_id = c.shader; |
| 6878 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 6921 uint32 bucket_id = static_cast<uint32>(c.bucket_id); |
| 6879 Bucket* bucket = CreateBucket(bucket_id); | 6922 Bucket* bucket = CreateBucket(bucket_id); |
| 6880 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); | 6923 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); |
| 6881 if (!shader || !shader->log_info()) { | 6924 if (!shader || !shader->log_info()) { |
| 6882 bucket->SetFromString(""); | 6925 bucket->SetFromString(""); |
| 6883 return error::kNoError; | 6926 return error::kNoError; |
| 6884 } | 6927 } |
| 6885 bucket->SetFromString(shader->log_info()->c_str()); | 6928 bucket->SetFromString(shader->log_info()->c_str()); |
| 6886 return error::kNoError; | 6929 return error::kNoError; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7159 } | 7202 } |
| 7160 } | 7203 } |
| 7161 | 7204 |
| 7162 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { | 7205 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { |
| 7163 if (SetVertexAttribValue("glVertexAttrib4fv", index, v)) { | 7206 if (SetVertexAttribValue("glVertexAttrib4fv", index, v)) { |
| 7164 glVertexAttrib4fv(index, v); | 7207 glVertexAttrib4fv(index, v); |
| 7165 } | 7208 } |
| 7166 } | 7209 } |
| 7167 | 7210 |
| 7168 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( | 7211 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( |
| 7169 uint32 immediate_data_size, const cmds::VertexAttribPointer& c) { | 7212 uint32 immediate_data_size, |
| 7213 const void* cmd_data) { | |
| 7214 const gles2::cmds::VertexAttribPointer& c = | |
| 7215 *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); | |
| 7170 | 7216 |
| 7171 if (!state_.bound_array_buffer.get() || | 7217 if (!state_.bound_array_buffer.get() || |
| 7172 state_.bound_array_buffer->IsDeleted()) { | 7218 state_.bound_array_buffer->IsDeleted()) { |
| 7173 if (state_.vertex_attrib_manager.get() == | 7219 if (state_.vertex_attrib_manager.get() == |
| 7174 state_.default_vertex_attrib_manager.get()) { | 7220 state_.default_vertex_attrib_manager.get()) { |
| 7175 LOCAL_SET_GL_ERROR( | 7221 LOCAL_SET_GL_ERROR( |
| 7176 GL_INVALID_VALUE, "glVertexAttribPointer", "no array buffer bound"); | 7222 GL_INVALID_VALUE, "glVertexAttribPointer", "no array buffer bound"); |
| 7177 return error::kNoError; | 7223 return error::kNoError; |
| 7178 } else if (c.offset != 0) { | 7224 } else if (c.offset != 0) { |
| 7179 LOCAL_SET_GL_ERROR( | 7225 LOCAL_SET_GL_ERROR( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7253 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, | 7299 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, |
| 7254 GLsizei height) { | 7300 GLsizei height) { |
| 7255 state_.viewport_x = x; | 7301 state_.viewport_x = x; |
| 7256 state_.viewport_y = y; | 7302 state_.viewport_y = y; |
| 7257 state_.viewport_width = std::min(width, viewport_max_width_); | 7303 state_.viewport_width = std::min(width, viewport_max_width_); |
| 7258 state_.viewport_height = std::min(height, viewport_max_height_); | 7304 state_.viewport_height = std::min(height, viewport_max_height_); |
| 7259 glViewport(x, y, width, height); | 7305 glViewport(x, y, width, height); |
| 7260 } | 7306 } |
| 7261 | 7307 |
| 7262 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( | 7308 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( |
| 7263 uint32 immediate_data_size, const cmds::VertexAttribDivisorANGLE& c) { | 7309 uint32 immediate_data_size, |
| 7310 const void* cmd_data) { | |
| 7311 const gles2::cmds::VertexAttribDivisorANGLE& c = | |
| 7312 *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); | |
| 7264 if (!features().angle_instanced_arrays) { | 7313 if (!features().angle_instanced_arrays) { |
| 7265 LOCAL_SET_GL_ERROR( | 7314 LOCAL_SET_GL_ERROR( |
| 7266 GL_INVALID_OPERATION, | 7315 GL_INVALID_OPERATION, |
| 7267 "glVertexAttribDivisorANGLE", "function not available"); | 7316 "glVertexAttribDivisorANGLE", "function not available"); |
| 7268 return error::kNoError; | 7317 return error::kNoError; |
| 7269 } | 7318 } |
| 7270 GLuint index = c.index; | 7319 GLuint index = c.index; |
| 7271 GLuint divisor = c.divisor; | 7320 GLuint divisor = c.divisor; |
| 7272 if (index >= group_->max_vertex_attribs()) { | 7321 if (index >= group_->max_vertex_attribs()) { |
| 7273 LOCAL_SET_GL_ERROR( | 7322 LOCAL_SET_GL_ERROR( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7404 case GL_HALF_FLOAT: | 7453 case GL_HALF_FLOAT: |
| 7405 WriteAlphaData<uint16>( | 7454 WriteAlphaData<uint16>( |
| 7406 pixels, height, channel_count, alpha_channel, unpadded_row_size, | 7455 pixels, height, channel_count, alpha_channel, unpadded_row_size, |
| 7407 padded_row_size, 0x3C00); | 7456 padded_row_size, 0x3C00); |
| 7408 break; | 7457 break; |
| 7409 } | 7458 } |
| 7410 } | 7459 } |
| 7411 } | 7460 } |
| 7412 } | 7461 } |
| 7413 | 7462 |
| 7414 | 7463 error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size, |
| 7415 error::Error GLES2DecoderImpl::HandleReadPixels( | 7464 const void* cmd_data) { |
| 7416 uint32 immediate_data_size, const cmds::ReadPixels& c) { | 7465 const gles2::cmds::ReadPixels& c = |
| 7466 *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); | |
| 7417 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); | 7467 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); |
| 7418 error::Error fbo_error = WillAccessBoundFramebufferForRead(); | 7468 error::Error fbo_error = WillAccessBoundFramebufferForRead(); |
| 7419 if (fbo_error != error::kNoError) | 7469 if (fbo_error != error::kNoError) |
| 7420 return fbo_error; | 7470 return fbo_error; |
| 7421 GLint x = c.x; | 7471 GLint x = c.x; |
| 7422 GLint y = c.y; | 7472 GLint y = c.y; |
| 7423 GLsizei width = c.width; | 7473 GLsizei width = c.width; |
| 7424 GLsizei height = c.height; | 7474 GLsizei height = c.height; |
| 7425 GLenum format = c.format; | 7475 GLenum format = c.format; |
| 7426 GLenum type = c.type; | 7476 GLenum type = c.type; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7572 if (error == GL_NO_ERROR) { | 7622 if (error == GL_NO_ERROR) { |
| 7573 if (result != NULL) { | 7623 if (result != NULL) { |
| 7574 *result = true; | 7624 *result = true; |
| 7575 } | 7625 } |
| 7576 FinishReadPixels(c, 0); | 7626 FinishReadPixels(c, 0); |
| 7577 } | 7627 } |
| 7578 | 7628 |
| 7579 return error::kNoError; | 7629 return error::kNoError; |
| 7580 } | 7630 } |
| 7581 | 7631 |
| 7582 error::Error GLES2DecoderImpl::HandlePixelStorei( | 7632 error::Error GLES2DecoderImpl::HandlePixelStorei(uint32 immediate_data_size, |
| 7583 uint32 immediate_data_size, const cmds::PixelStorei& c) { | 7633 const void* cmd_data) { |
| 7634 const gles2::cmds::PixelStorei& c = | |
| 7635 *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); | |
| 7584 GLenum pname = c.pname; | 7636 GLenum pname = c.pname; |
| 7585 GLenum param = c.param; | 7637 GLenum param = c.param; |
| 7586 if (!validators_->pixel_store.IsValid(pname)) { | 7638 if (!validators_->pixel_store.IsValid(pname)) { |
| 7587 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); | 7639 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); |
| 7588 return error::kNoError; | 7640 return error::kNoError; |
| 7589 } | 7641 } |
| 7590 switch (pname) { | 7642 switch (pname) { |
| 7591 case GL_PACK_ALIGNMENT: | 7643 case GL_PACK_ALIGNMENT: |
| 7592 case GL_UNPACK_ALIGNMENT: | 7644 case GL_UNPACK_ALIGNMENT: |
| 7593 if (!validators_->pixel_store_alignment.IsValid(param)) { | 7645 if (!validators_->pixel_store_alignment.IsValid(param)) { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 7621 break; | 7673 break; |
| 7622 default: | 7674 default: |
| 7623 // Validation should have prevented us from getting here. | 7675 // Validation should have prevented us from getting here. |
| 7624 NOTREACHED(); | 7676 NOTREACHED(); |
| 7625 break; | 7677 break; |
| 7626 } | 7678 } |
| 7627 return error::kNoError; | 7679 return error::kNoError; |
| 7628 } | 7680 } |
| 7629 | 7681 |
| 7630 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 7682 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
| 7631 uint32 immediate_data_size, const cmds::PostSubBufferCHROMIUM& c) { | 7683 uint32 immediate_data_size, |
| 7684 const void* cmd_data) { | |
| 7685 const gles2::cmds::PostSubBufferCHROMIUM& c = | |
| 7686 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); | |
| 7632 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); | 7687 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); |
| 7633 { | 7688 { |
| 7634 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); | 7689 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); |
| 7635 } | 7690 } |
| 7636 if (!supports_post_sub_buffer_) { | 7691 if (!supports_post_sub_buffer_) { |
| 7637 LOCAL_SET_GL_ERROR( | 7692 LOCAL_SET_GL_ERROR( |
| 7638 GL_INVALID_OPERATION, | 7693 GL_INVALID_OPERATION, |
| 7639 "glPostSubBufferCHROMIUM", "command not supported by surface"); | 7694 "glPostSubBufferCHROMIUM", "command not supported by surface"); |
| 7640 return error::kNoError; | 7695 return error::kNoError; |
| 7641 } | 7696 } |
| 7642 bool is_tracing; | 7697 bool is_tracing; |
| 7643 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), | 7698 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| 7644 &is_tracing); | 7699 &is_tracing); |
| 7645 if (is_tracing) { | 7700 if (is_tracing) { |
| 7646 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 7701 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
| 7647 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); | 7702 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); |
| 7648 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( | 7703 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
| 7649 is_offscreen ? offscreen_size_ : surface_->GetSize()); | 7704 is_offscreen ? offscreen_size_ : surface_->GetSize()); |
| 7650 } | 7705 } |
| 7651 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { | 7706 if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { |
| 7652 return error::kNoError; | 7707 return error::kNoError; |
| 7653 } else { | 7708 } else { |
| 7654 LOG(ERROR) << "Context lost because PostSubBuffer failed."; | 7709 LOG(ERROR) << "Context lost because PostSubBuffer failed."; |
| 7655 return error::kLostContext; | 7710 return error::kLostContext; |
| 7656 } | 7711 } |
| 7657 } | 7712 } |
| 7658 | 7713 |
| 7659 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( | 7714 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( |
| 7660 uint32 immediate_data_size, | 7715 uint32 immediate_data_size, |
| 7661 const cmds::ScheduleOverlayPlaneCHROMIUM& c) { | 7716 const void* cmd_data) { |
| 7717 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = | |
| 7718 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); | |
| 7662 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); | 7719 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); |
| 7663 if (!ref) { | 7720 if (!ref) { |
| 7664 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | 7721 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, |
| 7665 "glScheduleOverlayPlaneCHROMIUM", | 7722 "glScheduleOverlayPlaneCHROMIUM", |
| 7666 "unknown texture"); | 7723 "unknown texture"); |
| 7667 return error::kNoError; | 7724 return error::kNoError; |
| 7668 } | 7725 } |
| 7669 gfx::GLImage* image = | 7726 gfx::GLImage* image = |
| 7670 ref->texture()->GetLevelImage(ref->texture()->target(), 0); | 7727 ref->texture()->GetLevelImage(ref->texture()->target(), 0); |
| 7671 if (!image) { | 7728 if (!image) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7720 // Require the client to init this incase the context is lost and we are no | 7777 // Require the client to init this incase the context is lost and we are no |
| 7721 // longer executing commands. | 7778 // longer executing commands. |
| 7722 if (*location != -1) { | 7779 if (*location != -1) { |
| 7723 return error::kGenericError; | 7780 return error::kGenericError; |
| 7724 } | 7781 } |
| 7725 *location = program->GetAttribLocation(name_str); | 7782 *location = program->GetAttribLocation(name_str); |
| 7726 return error::kNoError; | 7783 return error::kNoError; |
| 7727 } | 7784 } |
| 7728 | 7785 |
| 7729 error::Error GLES2DecoderImpl::HandleGetAttribLocation( | 7786 error::Error GLES2DecoderImpl::HandleGetAttribLocation( |
| 7730 uint32 immediate_data_size, const cmds::GetAttribLocation& c) { | 7787 uint32 immediate_data_size, |
| 7788 const void* cmd_data) { | |
| 7789 const gles2::cmds::GetAttribLocation& c = | |
| 7790 *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); | |
| 7731 Bucket* bucket = GetBucket(c.name_bucket_id); | 7791 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 7732 if (!bucket) { | 7792 if (!bucket) { |
| 7733 return error::kInvalidArguments; | 7793 return error::kInvalidArguments; |
| 7734 } | 7794 } |
| 7735 std::string name_str; | 7795 std::string name_str; |
| 7736 if (!bucket->GetAsString(&name_str)) { | 7796 if (!bucket->GetAsString(&name_str)) { |
| 7737 return error::kInvalidArguments; | 7797 return error::kInvalidArguments; |
| 7738 } | 7798 } |
| 7739 return GetAttribLocationHelper( | 7799 return GetAttribLocationHelper( |
| 7740 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 7800 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 7766 // Require the client to init this incase the context is lost an we are no | 7826 // Require the client to init this incase the context is lost an we are no |
| 7767 // longer executing commands. | 7827 // longer executing commands. |
| 7768 if (*location != -1) { | 7828 if (*location != -1) { |
| 7769 return error::kGenericError; | 7829 return error::kGenericError; |
| 7770 } | 7830 } |
| 7771 *location = program->GetUniformFakeLocation(name_str); | 7831 *location = program->GetUniformFakeLocation(name_str); |
| 7772 return error::kNoError; | 7832 return error::kNoError; |
| 7773 } | 7833 } |
| 7774 | 7834 |
| 7775 error::Error GLES2DecoderImpl::HandleGetUniformLocation( | 7835 error::Error GLES2DecoderImpl::HandleGetUniformLocation( |
| 7776 uint32 immediate_data_size, const cmds::GetUniformLocation& c) { | 7836 uint32 immediate_data_size, |
| 7837 const void* cmd_data) { | |
| 7838 const gles2::cmds::GetUniformLocation& c = | |
| 7839 *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); | |
| 7777 Bucket* bucket = GetBucket(c.name_bucket_id); | 7840 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 7778 if (!bucket) { | 7841 if (!bucket) { |
| 7779 return error::kInvalidArguments; | 7842 return error::kInvalidArguments; |
| 7780 } | 7843 } |
| 7781 std::string name_str; | 7844 std::string name_str; |
| 7782 if (!bucket->GetAsString(&name_str)) { | 7845 if (!bucket->GetAsString(&name_str)) { |
| 7783 return error::kInvalidArguments; | 7846 return error::kInvalidArguments; |
| 7784 } | 7847 } |
| 7785 return GetUniformLocationHelper( | 7848 return GetUniformLocationHelper( |
| 7786 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 7849 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 7787 } | 7850 } |
| 7788 | 7851 |
| 7789 error::Error GLES2DecoderImpl::HandleGetString( | 7852 error::Error GLES2DecoderImpl::HandleGetString(uint32 immediate_data_size, |
| 7790 uint32 immediate_data_size, const cmds::GetString& c) { | 7853 const void* cmd_data) { |
| 7854 const gles2::cmds::GetString& c = | |
| 7855 *static_cast<const gles2::cmds::GetString*>(cmd_data); | |
| 7791 GLenum name = static_cast<GLenum>(c.name); | 7856 GLenum name = static_cast<GLenum>(c.name); |
| 7792 if (!validators_->string_type.IsValid(name)) { | 7857 if (!validators_->string_type.IsValid(name)) { |
| 7793 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); | 7858 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); |
| 7794 return error::kNoError; | 7859 return error::kNoError; |
| 7795 } | 7860 } |
| 7796 const char* str = reinterpret_cast<const char*>(glGetString(name)); | 7861 const char* str = reinterpret_cast<const char*>(glGetString(name)); |
| 7797 std::string extensions; | 7862 std::string extensions; |
| 7798 switch (name) { | 7863 switch (name) { |
| 7799 case GL_VERSION: | 7864 case GL_VERSION: |
| 7800 str = "OpenGL ES 2.0 Chromium"; | 7865 str = "OpenGL ES 2.0 Chromium"; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7853 } | 7918 } |
| 7854 break; | 7919 break; |
| 7855 default: | 7920 default: |
| 7856 break; | 7921 break; |
| 7857 } | 7922 } |
| 7858 Bucket* bucket = CreateBucket(c.bucket_id); | 7923 Bucket* bucket = CreateBucket(c.bucket_id); |
| 7859 bucket->SetFromString(str); | 7924 bucket->SetFromString(str); |
| 7860 return error::kNoError; | 7925 return error::kNoError; |
| 7861 } | 7926 } |
| 7862 | 7927 |
| 7863 error::Error GLES2DecoderImpl::HandleBufferData( | 7928 error::Error GLES2DecoderImpl::HandleBufferData(uint32 immediate_data_size, |
| 7864 uint32 immediate_data_size, const cmds::BufferData& c) { | 7929 const void* cmd_data) { |
| 7930 const gles2::cmds::BufferData& c = | |
| 7931 *static_cast<const gles2::cmds::BufferData*>(cmd_data); | |
| 7865 GLenum target = static_cast<GLenum>(c.target); | 7932 GLenum target = static_cast<GLenum>(c.target); |
| 7866 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 7933 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 7867 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 7934 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); |
| 7868 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 7935 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); |
| 7869 GLenum usage = static_cast<GLenum>(c.usage); | 7936 GLenum usage = static_cast<GLenum>(c.usage); |
| 7870 const void* data = NULL; | 7937 const void* data = NULL; |
| 7871 if (data_shm_id != 0 || data_shm_offset != 0) { | 7938 if (data_shm_id != 0 || data_shm_offset != 0) { |
| 7872 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); | 7939 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); |
| 7873 if (!data) { | 7940 if (!data) { |
| 7874 return error::kOutOfBounds; | 7941 return error::kOutOfBounds; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8258 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); | 8325 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); |
| 8259 if (error == GL_NO_ERROR) { | 8326 if (error == GL_NO_ERROR) { |
| 8260 texture_manager()->SetLevelInfo( | 8327 texture_manager()->SetLevelInfo( |
| 8261 texture_ref, target, level, internal_format, | 8328 texture_ref, target, level, internal_format, |
| 8262 width, height, 1, border, 0, 0, true); | 8329 width, height, 1, border, 0, 0, true); |
| 8263 } | 8330 } |
| 8264 return error::kNoError; | 8331 return error::kNoError; |
| 8265 } | 8332 } |
| 8266 | 8333 |
| 8267 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( | 8334 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( |
| 8268 uint32 immediate_data_size, const cmds::CompressedTexImage2D& c) { | 8335 uint32 immediate_data_size, |
| 8336 const void* cmd_data) { | |
| 8337 const gles2::cmds::CompressedTexImage2D& c = | |
| 8338 *static_cast<const gles2::cmds::CompressedTexImage2D*>(cmd_data); | |
| 8269 GLenum target = static_cast<GLenum>(c.target); | 8339 GLenum target = static_cast<GLenum>(c.target); |
| 8270 GLint level = static_cast<GLint>(c.level); | 8340 GLint level = static_cast<GLint>(c.level); |
| 8271 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 8341 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 8272 GLsizei width = static_cast<GLsizei>(c.width); | 8342 GLsizei width = static_cast<GLsizei>(c.width); |
| 8273 GLsizei height = static_cast<GLsizei>(c.height); | 8343 GLsizei height = static_cast<GLsizei>(c.height); |
| 8274 GLint border = static_cast<GLint>(c.border); | 8344 GLint border = static_cast<GLint>(c.border); |
| 8275 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 8345 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 8276 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 8346 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); |
| 8277 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 8347 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); |
| 8278 const void* data = NULL; | 8348 const void* data = NULL; |
| 8279 if (data_shm_id != 0 || data_shm_offset != 0) { | 8349 if (data_shm_id != 0 || data_shm_offset != 0) { |
| 8280 data = GetSharedMemoryAs<const void*>( | 8350 data = GetSharedMemoryAs<const void*>( |
| 8281 data_shm_id, data_shm_offset, image_size); | 8351 data_shm_id, data_shm_offset, image_size); |
| 8282 if (!data) { | 8352 if (!data) { |
| 8283 return error::kOutOfBounds; | 8353 return error::kOutOfBounds; |
| 8284 } | 8354 } |
| 8285 } | 8355 } |
| 8286 return DoCompressedTexImage2D( | 8356 return DoCompressedTexImage2D( |
| 8287 target, level, internal_format, width, height, border, image_size, data); | 8357 target, level, internal_format, width, height, border, image_size, data); |
| 8288 } | 8358 } |
| 8289 | 8359 |
| 8290 error::Error GLES2DecoderImpl::HandleCompressedTexImage2DBucket( | 8360 error::Error GLES2DecoderImpl::HandleCompressedTexImage2DBucket( |
| 8291 uint32 immediate_data_size, const cmds::CompressedTexImage2DBucket& c) { | 8361 uint32 immediate_data_size, |
| 8362 const void* cmd_data) { | |
| 8363 const gles2::cmds::CompressedTexImage2DBucket& c = | |
| 8364 *static_cast<const gles2::cmds::CompressedTexImage2DBucket*>(cmd_data); | |
| 8292 GLenum target = static_cast<GLenum>(c.target); | 8365 GLenum target = static_cast<GLenum>(c.target); |
| 8293 GLint level = static_cast<GLint>(c.level); | 8366 GLint level = static_cast<GLint>(c.level); |
| 8294 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 8367 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 8295 GLsizei width = static_cast<GLsizei>(c.width); | 8368 GLsizei width = static_cast<GLsizei>(c.width); |
| 8296 GLsizei height = static_cast<GLsizei>(c.height); | 8369 GLsizei height = static_cast<GLsizei>(c.height); |
| 8297 GLint border = static_cast<GLint>(c.border); | 8370 GLint border = static_cast<GLint>(c.border); |
| 8298 Bucket* bucket = GetBucket(c.bucket_id); | 8371 Bucket* bucket = GetBucket(c.bucket_id); |
| 8299 if (!bucket) { | 8372 if (!bucket) { |
| 8300 return error::kInvalidArguments; | 8373 return error::kInvalidArguments; |
| 8301 } | 8374 } |
| 8302 uint32 data_size = bucket->size(); | 8375 uint32 data_size = bucket->size(); |
| 8303 GLsizei imageSize = data_size; | 8376 GLsizei imageSize = data_size; |
| 8304 const void* data = bucket->GetData(0, data_size); | 8377 const void* data = bucket->GetData(0, data_size); |
| 8305 if (!data) { | 8378 if (!data) { |
| 8306 return error::kInvalidArguments; | 8379 return error::kInvalidArguments; |
| 8307 } | 8380 } |
| 8308 return DoCompressedTexImage2D( | 8381 return DoCompressedTexImage2D( |
| 8309 target, level, internal_format, width, height, border, | 8382 target, level, internal_format, width, height, border, |
| 8310 imageSize, data); | 8383 imageSize, data); |
| 8311 } | 8384 } |
| 8312 | 8385 |
| 8313 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DBucket( | 8386 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DBucket( |
| 8314 uint32 immediate_data_size, | 8387 uint32 immediate_data_size, |
| 8315 const cmds::CompressedTexSubImage2DBucket& c) { | 8388 const void* cmd_data) { |
| 8389 const gles2::cmds::CompressedTexSubImage2DBucket& c = | |
| 8390 *static_cast<const gles2::cmds::CompressedTexSubImage2DBucket*>(cmd_data); | |
| 8316 GLenum target = static_cast<GLenum>(c.target); | 8391 GLenum target = static_cast<GLenum>(c.target); |
| 8317 GLint level = static_cast<GLint>(c.level); | 8392 GLint level = static_cast<GLint>(c.level); |
| 8318 GLint xoffset = static_cast<GLint>(c.xoffset); | 8393 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 8319 GLint yoffset = static_cast<GLint>(c.yoffset); | 8394 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 8320 GLsizei width = static_cast<GLsizei>(c.width); | 8395 GLsizei width = static_cast<GLsizei>(c.width); |
| 8321 GLsizei height = static_cast<GLsizei>(c.height); | 8396 GLsizei height = static_cast<GLsizei>(c.height); |
| 8322 GLenum format = static_cast<GLenum>(c.format); | 8397 GLenum format = static_cast<GLenum>(c.format); |
| 8323 Bucket* bucket = GetBucket(c.bucket_id); | 8398 Bucket* bucket = GetBucket(c.bucket_id); |
| 8324 if (!bucket) { | 8399 if (!bucket) { |
| 8325 return error::kInvalidArguments; | 8400 return error::kInvalidArguments; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 8353 if (imageSize < 0) { | 8428 if (imageSize < 0) { |
| 8354 LOCAL_SET_GL_ERROR( | 8429 LOCAL_SET_GL_ERROR( |
| 8355 GL_INVALID_VALUE, "glCompressedTexSubImage2D", "imageSize < 0"); | 8430 GL_INVALID_VALUE, "glCompressedTexSubImage2D", "imageSize < 0"); |
| 8356 return error::kNoError; | 8431 return error::kNoError; |
| 8357 } | 8432 } |
| 8358 DoCompressedTexSubImage2D( | 8433 DoCompressedTexSubImage2D( |
| 8359 target, level, xoffset, yoffset, width, height, format, imageSize, data); | 8434 target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 8360 return error::kNoError; | 8435 return error::kNoError; |
| 8361 } | 8436 } |
| 8362 | 8437 |
| 8363 error::Error GLES2DecoderImpl::HandleTexImage2D( | 8438 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32 immediate_data_size, |
| 8364 uint32 immediate_data_size, const cmds::TexImage2D& c) { | 8439 const void* cmd_data) { |
| 8440 const gles2::cmds::TexImage2D& c = | |
| 8441 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); | |
| 8365 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", | 8442 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", |
| 8366 "width", c.width, "height", c.height); | 8443 "width", c.width, "height", c.height); |
| 8367 // Set as failed for now, but if it successed, this will be set to not failed. | 8444 // Set as failed for now, but if it successed, this will be set to not failed. |
| 8368 texture_state_.tex_image_2d_failed = true; | 8445 texture_state_.tex_image_2d_failed = true; |
| 8369 GLenum target = static_cast<GLenum>(c.target); | 8446 GLenum target = static_cast<GLenum>(c.target); |
| 8370 GLint level = static_cast<GLint>(c.level); | 8447 GLint level = static_cast<GLint>(c.level); |
| 8371 // TODO(kloveless): Change TexImage2D command to use unsigned integer | 8448 // TODO(kloveless): Change TexImage2D command to use unsigned integer |
| 8372 // for internalformat. | 8449 // for internalformat. |
| 8373 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 8450 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 8374 GLsizei width = static_cast<GLsizei>(c.width); | 8451 GLsizei width = static_cast<GLsizei>(c.width); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8837 target, level, internal_format, width, height, 0, format, type, data); | 8914 target, level, internal_format, width, height, 0, format, type, data); |
| 8838 } else { | 8915 } else { |
| 8839 ScopedTextureUploadTimer timer(&texture_state_); | 8916 ScopedTextureUploadTimer timer(&texture_state_); |
| 8840 glTexSubImage2D( | 8917 glTexSubImage2D( |
| 8841 target, level, xoffset, yoffset, width, height, format, type, data); | 8918 target, level, xoffset, yoffset, width, height, format, type, data); |
| 8842 } | 8919 } |
| 8843 texture_manager()->SetLevelCleared(texture_ref, target, level, true); | 8920 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 8844 return error::kNoError; | 8921 return error::kNoError; |
| 8845 } | 8922 } |
| 8846 | 8923 |
| 8847 error::Error GLES2DecoderImpl::HandleTexSubImage2D( | 8924 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32 immediate_data_size, |
| 8848 uint32 immediate_data_size, const cmds::TexSubImage2D& c) { | 8925 const void* cmd_data) { |
| 8926 const gles2::cmds::TexSubImage2D& c = | |
| 8927 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); | |
| 8849 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", | 8928 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", |
| 8850 "width", c.width, "height", c.height); | 8929 "width", c.width, "height", c.height); |
| 8851 GLboolean internal = static_cast<GLboolean>(c.internal); | 8930 GLboolean internal = static_cast<GLboolean>(c.internal); |
| 8852 if (internal == GL_TRUE && texture_state_.tex_image_2d_failed) | 8931 if (internal == GL_TRUE && texture_state_.tex_image_2d_failed) |
| 8853 return error::kNoError; | 8932 return error::kNoError; |
| 8854 | 8933 |
| 8855 GLenum target = static_cast<GLenum>(c.target); | 8934 GLenum target = static_cast<GLenum>(c.target); |
| 8856 GLint level = static_cast<GLint>(c.level); | 8935 GLint level = static_cast<GLint>(c.level); |
| 8857 GLint xoffset = static_cast<GLint>(c.xoffset); | 8936 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 8858 GLint yoffset = static_cast<GLint>(c.yoffset); | 8937 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 8859 GLsizei width = static_cast<GLsizei>(c.width); | 8938 GLsizei width = static_cast<GLsizei>(c.width); |
| 8860 GLsizei height = static_cast<GLsizei>(c.height); | 8939 GLsizei height = static_cast<GLsizei>(c.height); |
| 8861 GLenum format = static_cast<GLenum>(c.format); | 8940 GLenum format = static_cast<GLenum>(c.format); |
| 8862 GLenum type = static_cast<GLenum>(c.type); | 8941 GLenum type = static_cast<GLenum>(c.type); |
| 8863 uint32 data_size; | 8942 uint32 data_size; |
| 8864 if (!GLES2Util::ComputeImageDataSizes( | 8943 if (!GLES2Util::ComputeImageDataSizes( |
| 8865 width, height, format, type, state_.unpack_alignment, &data_size, | 8944 width, height, format, type, state_.unpack_alignment, &data_size, |
| 8866 NULL, NULL)) { | 8945 NULL, NULL)) { |
| 8867 return error::kOutOfBounds; | 8946 return error::kOutOfBounds; |
| 8868 } | 8947 } |
| 8869 const void* pixels = GetSharedMemoryAs<const void*>( | 8948 const void* pixels = GetSharedMemoryAs<const void*>( |
| 8870 c.pixels_shm_id, c.pixels_shm_offset, data_size); | 8949 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
| 8871 return DoTexSubImage2D( | 8950 return DoTexSubImage2D( |
| 8872 target, level, xoffset, yoffset, width, height, format, type, pixels); | 8951 target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 8873 } | 8952 } |
| 8874 | 8953 |
| 8875 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( | 8954 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( |
| 8876 uint32 immediate_data_size, const cmds::GetVertexAttribPointerv& c) { | 8955 uint32 immediate_data_size, |
| 8956 const void* cmd_data) { | |
| 8957 const gles2::cmds::GetVertexAttribPointerv& c = | |
| 8958 *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); | |
| 8877 GLuint index = static_cast<GLuint>(c.index); | 8959 GLuint index = static_cast<GLuint>(c.index); |
| 8878 GLenum pname = static_cast<GLenum>(c.pname); | 8960 GLenum pname = static_cast<GLenum>(c.pname); |
| 8879 typedef cmds::GetVertexAttribPointerv::Result Result; | 8961 typedef cmds::GetVertexAttribPointerv::Result Result; |
| 8880 Result* result = GetSharedMemoryAs<Result*>( | 8962 Result* result = GetSharedMemoryAs<Result*>( |
| 8881 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); | 8963 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); |
| 8882 if (!result) { | 8964 if (!result) { |
| 8883 return error::kOutOfBounds; | 8965 return error::kOutOfBounds; |
| 8884 } | 8966 } |
| 8885 // Check that the client initialized the result. | 8967 // Check that the client initialized the result. |
| 8886 if (result->size != 0) { | 8968 if (result->size != 0) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8955 shm_id, shm_offset, SizedResult<GLint>::ComputeSizeFromBytes(size)); | 9037 shm_id, shm_offset, SizedResult<GLint>::ComputeSizeFromBytes(size)); |
| 8956 if (!result) { | 9038 if (!result) { |
| 8957 *error = error::kOutOfBounds; | 9039 *error = error::kOutOfBounds; |
| 8958 return false; | 9040 return false; |
| 8959 } | 9041 } |
| 8960 result->size = size; | 9042 result->size = size; |
| 8961 *result_type = type; | 9043 *result_type = type; |
| 8962 return true; | 9044 return true; |
| 8963 } | 9045 } |
| 8964 | 9046 |
| 8965 error::Error GLES2DecoderImpl::HandleGetUniformiv( | 9047 error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32 immediate_data_size, |
| 8966 uint32 immediate_data_size, const cmds::GetUniformiv& c) { | 9048 const void* cmd_data) { |
| 9049 const gles2::cmds::GetUniformiv& c = | |
| 9050 *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); | |
| 8967 GLuint program = c.program; | 9051 GLuint program = c.program; |
| 8968 GLint fake_location = c.location; | 9052 GLint fake_location = c.location; |
| 8969 GLuint service_id; | 9053 GLuint service_id; |
| 8970 GLenum result_type; | 9054 GLenum result_type; |
| 8971 GLint real_location = -1; | 9055 GLint real_location = -1; |
| 8972 Error error; | 9056 Error error; |
| 8973 void* result; | 9057 void* result; |
| 8974 if (GetUniformSetup( | 9058 if (GetUniformSetup( |
| 8975 program, fake_location, c.params_shm_id, c.params_shm_offset, | 9059 program, fake_location, c.params_shm_id, c.params_shm_offset, |
| 8976 &error, &real_location, &service_id, &result, &result_type)) { | 9060 &error, &real_location, &service_id, &result, &result_type)) { |
| 8977 glGetUniformiv( | 9061 glGetUniformiv( |
| 8978 service_id, real_location, | 9062 service_id, real_location, |
| 8979 static_cast<cmds::GetUniformiv::Result*>(result)->GetData()); | 9063 static_cast<cmds::GetUniformiv::Result*>(result)->GetData()); |
| 8980 } | 9064 } |
| 8981 return error; | 9065 return error; |
| 8982 } | 9066 } |
| 8983 | 9067 |
| 8984 error::Error GLES2DecoderImpl::HandleGetUniformfv( | 9068 error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32 immediate_data_size, |
| 8985 uint32 immediate_data_size, const cmds::GetUniformfv& c) { | 9069 const void* cmd_data) { |
| 9070 const gles2::cmds::GetUniformfv& c = | |
| 9071 *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); | |
| 8986 GLuint program = c.program; | 9072 GLuint program = c.program; |
| 8987 GLint fake_location = c.location; | 9073 GLint fake_location = c.location; |
| 8988 GLuint service_id; | 9074 GLuint service_id; |
| 8989 GLint real_location = -1; | 9075 GLint real_location = -1; |
| 8990 Error error; | 9076 Error error; |
| 8991 typedef cmds::GetUniformfv::Result Result; | 9077 typedef cmds::GetUniformfv::Result Result; |
| 8992 Result* result; | 9078 Result* result; |
| 8993 GLenum result_type; | 9079 GLenum result_type; |
| 8994 if (GetUniformSetup( | 9080 if (GetUniformSetup( |
| 8995 program, fake_location, c.params_shm_id, c.params_shm_offset, | 9081 program, fake_location, c.params_shm_id, c.params_shm_offset, |
| 8996 &error, &real_location, &service_id, | 9082 &error, &real_location, &service_id, |
| 8997 reinterpret_cast<void**>(&result), &result_type)) { | 9083 reinterpret_cast<void**>(&result), &result_type)) { |
| 8998 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || | 9084 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || |
| 8999 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { | 9085 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { |
| 9000 GLsizei num_values = result->GetNumResults(); | 9086 GLsizei num_values = result->GetNumResults(); |
| 9001 scoped_ptr<GLint[]> temp(new GLint[num_values]); | 9087 scoped_ptr<GLint[]> temp(new GLint[num_values]); |
| 9002 glGetUniformiv(service_id, real_location, temp.get()); | 9088 glGetUniformiv(service_id, real_location, temp.get()); |
| 9003 GLfloat* dst = result->GetData(); | 9089 GLfloat* dst = result->GetData(); |
| 9004 for (GLsizei ii = 0; ii < num_values; ++ii) { | 9090 for (GLsizei ii = 0; ii < num_values; ++ii) { |
| 9005 dst[ii] = (temp[ii] != 0); | 9091 dst[ii] = (temp[ii] != 0); |
| 9006 } | 9092 } |
| 9007 } else { | 9093 } else { |
| 9008 glGetUniformfv(service_id, real_location, result->GetData()); | 9094 glGetUniformfv(service_id, real_location, result->GetData()); |
| 9009 } | 9095 } |
| 9010 } | 9096 } |
| 9011 return error; | 9097 return error; |
| 9012 } | 9098 } |
| 9013 | 9099 |
| 9014 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( | 9100 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( |
| 9015 uint32 immediate_data_size, const cmds::GetShaderPrecisionFormat& c) { | 9101 uint32 immediate_data_size, |
| 9102 const void* cmd_data) { | |
| 9103 const gles2::cmds::GetShaderPrecisionFormat& c = | |
| 9104 *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); | |
| 9016 GLenum shader_type = static_cast<GLenum>(c.shadertype); | 9105 GLenum shader_type = static_cast<GLenum>(c.shadertype); |
| 9017 GLenum precision_type = static_cast<GLenum>(c.precisiontype); | 9106 GLenum precision_type = static_cast<GLenum>(c.precisiontype); |
| 9018 typedef cmds::GetShaderPrecisionFormat::Result Result; | 9107 typedef cmds::GetShaderPrecisionFormat::Result Result; |
| 9019 Result* result = GetSharedMemoryAs<Result*>( | 9108 Result* result = GetSharedMemoryAs<Result*>( |
| 9020 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 9109 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 9021 if (!result) { | 9110 if (!result) { |
| 9022 return error::kOutOfBounds; | 9111 return error::kOutOfBounds; |
| 9023 } | 9112 } |
| 9024 // Check that the client initialized the result. | 9113 // Check that the client initialized the result. |
| 9025 if (result->success != 0) { | 9114 if (result->success != 0) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 9043 GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); | 9132 GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); |
| 9044 | 9133 |
| 9045 result->min_range = range[0]; | 9134 result->min_range = range[0]; |
| 9046 result->max_range = range[1]; | 9135 result->max_range = range[1]; |
| 9047 result->precision = precision; | 9136 result->precision = precision; |
| 9048 | 9137 |
| 9049 return error::kNoError; | 9138 return error::kNoError; |
| 9050 } | 9139 } |
| 9051 | 9140 |
| 9052 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( | 9141 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( |
| 9053 uint32 immediate_data_size, const cmds::GetAttachedShaders& c) { | 9142 uint32 immediate_data_size, |
| 9143 const void* cmd_data) { | |
| 9144 const gles2::cmds::GetAttachedShaders& c = | |
| 9145 *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); | |
| 9054 uint32 result_size = c.result_size; | 9146 uint32 result_size = c.result_size; |
| 9055 GLuint program_id = static_cast<GLuint>(c.program); | 9147 GLuint program_id = static_cast<GLuint>(c.program); |
| 9056 Program* program = GetProgramInfoNotShader( | 9148 Program* program = GetProgramInfoNotShader( |
| 9057 program_id, "glGetAttachedShaders"); | 9149 program_id, "glGetAttachedShaders"); |
| 9058 if (!program) { | 9150 if (!program) { |
| 9059 return error::kNoError; | 9151 return error::kNoError; |
| 9060 } | 9152 } |
| 9061 typedef cmds::GetAttachedShaders::Result Result; | 9153 typedef cmds::GetAttachedShaders::Result Result; |
| 9062 uint32 max_count = Result::ComputeMaxResults(result_size); | 9154 uint32 max_count = Result::ComputeMaxResults(result_size); |
| 9063 Result* result = GetSharedMemoryAs<Result*>( | 9155 Result* result = GetSharedMemoryAs<Result*>( |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 9077 &result->GetData()[ii])) { | 9169 &result->GetData()[ii])) { |
| 9078 NOTREACHED(); | 9170 NOTREACHED(); |
| 9079 return error::kGenericError; | 9171 return error::kGenericError; |
| 9080 } | 9172 } |
| 9081 } | 9173 } |
| 9082 result->SetNumResults(count); | 9174 result->SetNumResults(count); |
| 9083 return error::kNoError; | 9175 return error::kNoError; |
| 9084 } | 9176 } |
| 9085 | 9177 |
| 9086 error::Error GLES2DecoderImpl::HandleGetActiveUniform( | 9178 error::Error GLES2DecoderImpl::HandleGetActiveUniform( |
| 9087 uint32 immediate_data_size, const cmds::GetActiveUniform& c) { | 9179 uint32 immediate_data_size, |
| 9180 const void* cmd_data) { | |
| 9181 const gles2::cmds::GetActiveUniform& c = | |
| 9182 *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); | |
| 9088 GLuint program_id = c.program; | 9183 GLuint program_id = c.program; |
| 9089 GLuint index = c.index; | 9184 GLuint index = c.index; |
| 9090 uint32 name_bucket_id = c.name_bucket_id; | 9185 uint32 name_bucket_id = c.name_bucket_id; |
| 9091 typedef cmds::GetActiveUniform::Result Result; | 9186 typedef cmds::GetActiveUniform::Result Result; |
| 9092 Result* result = GetSharedMemoryAs<Result*>( | 9187 Result* result = GetSharedMemoryAs<Result*>( |
| 9093 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 9188 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 9094 if (!result) { | 9189 if (!result) { |
| 9095 return error::kOutOfBounds; | 9190 return error::kOutOfBounds; |
| 9096 } | 9191 } |
| 9097 // Check that the client initialized the result. | 9192 // Check that the client initialized the result. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 9111 return error::kNoError; | 9206 return error::kNoError; |
| 9112 } | 9207 } |
| 9113 result->success = 1; // true. | 9208 result->success = 1; // true. |
| 9114 result->size = uniform_info->size; | 9209 result->size = uniform_info->size; |
| 9115 result->type = uniform_info->type; | 9210 result->type = uniform_info->type; |
| 9116 Bucket* bucket = CreateBucket(name_bucket_id); | 9211 Bucket* bucket = CreateBucket(name_bucket_id); |
| 9117 bucket->SetFromString(uniform_info->name.c_str()); | 9212 bucket->SetFromString(uniform_info->name.c_str()); |
| 9118 return error::kNoError; | 9213 return error::kNoError; |
| 9119 } | 9214 } |
| 9120 | 9215 |
| 9121 error::Error GLES2DecoderImpl::HandleGetActiveAttrib( | 9216 error::Error GLES2DecoderImpl::HandleGetActiveAttrib(uint32 immediate_data_size, |
| 9122 uint32 immediate_data_size, const cmds::GetActiveAttrib& c) { | 9217 const void* cmd_data) { |
| 9218 const gles2::cmds::GetActiveAttrib& c = | |
| 9219 *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); | |
| 9123 GLuint program_id = c.program; | 9220 GLuint program_id = c.program; |
| 9124 GLuint index = c.index; | 9221 GLuint index = c.index; |
| 9125 uint32 name_bucket_id = c.name_bucket_id; | 9222 uint32 name_bucket_id = c.name_bucket_id; |
| 9126 typedef cmds::GetActiveAttrib::Result Result; | 9223 typedef cmds::GetActiveAttrib::Result Result; |
| 9127 Result* result = GetSharedMemoryAs<Result*>( | 9224 Result* result = GetSharedMemoryAs<Result*>( |
| 9128 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 9225 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 9129 if (!result) { | 9226 if (!result) { |
| 9130 return error::kOutOfBounds; | 9227 return error::kOutOfBounds; |
| 9131 } | 9228 } |
| 9132 // Check that the client initialized the result. | 9229 // Check that the client initialized the result. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 9146 return error::kNoError; | 9243 return error::kNoError; |
| 9147 } | 9244 } |
| 9148 result->success = 1; // true. | 9245 result->success = 1; // true. |
| 9149 result->size = attrib_info->size; | 9246 result->size = attrib_info->size; |
| 9150 result->type = attrib_info->type; | 9247 result->type = attrib_info->type; |
| 9151 Bucket* bucket = CreateBucket(name_bucket_id); | 9248 Bucket* bucket = CreateBucket(name_bucket_id); |
| 9152 bucket->SetFromString(attrib_info->name.c_str()); | 9249 bucket->SetFromString(attrib_info->name.c_str()); |
| 9153 return error::kNoError; | 9250 return error::kNoError; |
| 9154 } | 9251 } |
| 9155 | 9252 |
| 9156 error::Error GLES2DecoderImpl::HandleShaderBinary( | 9253 error::Error GLES2DecoderImpl::HandleShaderBinary(uint32 immediate_data_size, |
| 9157 uint32 immediate_data_size, const cmds::ShaderBinary& c) { | 9254 const void* cmd_data) { |
| 9158 #if 1 // No binary shader support. | 9255 #if 1 // No binary shader support. |
| 9159 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); | 9256 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); |
| 9160 return error::kNoError; | 9257 return error::kNoError; |
| 9161 #else | 9258 #else |
| 9162 GLsizei n = static_cast<GLsizei>(c.n); | 9259 GLsizei n = static_cast<GLsizei>(c.n); |
| 9163 if (n < 0) { | 9260 if (n < 0) { |
| 9164 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); | 9261 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); |
| 9165 return error::kNoError; | 9262 return error::kNoError; |
| 9166 } | 9263 } |
| 9167 GLsizei length = static_cast<GLsizei>(c.length); | 9264 GLsizei length = static_cast<GLsizei>(c.length); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9303 } | 9400 } |
| 9304 } else { | 9401 } else { |
| 9305 if (!surface_->SwapBuffers()) { | 9402 if (!surface_->SwapBuffers()) { |
| 9306 LOG(ERROR) << "Context lost because SwapBuffers failed."; | 9403 LOG(ERROR) << "Context lost because SwapBuffers failed."; |
| 9307 LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 9404 LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 9308 } | 9405 } |
| 9309 } | 9406 } |
| 9310 } | 9407 } |
| 9311 | 9408 |
| 9312 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( | 9409 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( |
| 9313 uint32 immediate_data_size, const cmds::EnableFeatureCHROMIUM& c) { | 9410 uint32 immediate_data_size, |
| 9411 const void* cmd_data) { | |
| 9412 const gles2::cmds::EnableFeatureCHROMIUM& c = | |
| 9413 *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); | |
| 9314 Bucket* bucket = GetBucket(c.bucket_id); | 9414 Bucket* bucket = GetBucket(c.bucket_id); |
| 9315 if (!bucket || bucket->size() == 0) { | 9415 if (!bucket || bucket->size() == 0) { |
| 9316 return error::kInvalidArguments; | 9416 return error::kInvalidArguments; |
| 9317 } | 9417 } |
| 9318 typedef cmds::EnableFeatureCHROMIUM::Result Result; | 9418 typedef cmds::EnableFeatureCHROMIUM::Result Result; |
| 9319 Result* result = GetSharedMemoryAs<Result*>( | 9419 Result* result = GetSharedMemoryAs<Result*>( |
| 9320 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 9420 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 9321 if (!result) { | 9421 if (!result) { |
| 9322 return error::kOutOfBounds; | 9422 return error::kOutOfBounds; |
| 9323 } | 9423 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 9351 } else { | 9451 } else { |
| 9352 return error::kNoError; | 9452 return error::kNoError; |
| 9353 } | 9453 } |
| 9354 | 9454 |
| 9355 *result = 1; // true. | 9455 *result = 1; // true. |
| 9356 return error::kNoError; | 9456 return error::kNoError; |
| 9357 } | 9457 } |
| 9358 | 9458 |
| 9359 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( | 9459 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( |
| 9360 uint32 immediate_data_size, | 9460 uint32 immediate_data_size, |
| 9361 const cmds::GetRequestableExtensionsCHROMIUM& c) { | 9461 const void* cmd_data) { |
| 9462 const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = | |
| 9463 *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( | |
| 9464 cmd_data); | |
| 9362 Bucket* bucket = CreateBucket(c.bucket_id); | 9465 Bucket* bucket = CreateBucket(c.bucket_id); |
| 9363 scoped_refptr<FeatureInfo> info(new FeatureInfo()); | 9466 scoped_refptr<FeatureInfo> info(new FeatureInfo()); |
| 9364 info->Initialize(disallowed_features_); | 9467 info->Initialize(disallowed_features_); |
| 9365 bucket->SetFromString(info->extensions().c_str()); | 9468 bucket->SetFromString(info->extensions().c_str()); |
| 9366 return error::kNoError; | 9469 return error::kNoError; |
| 9367 } | 9470 } |
| 9368 | 9471 |
| 9369 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( | 9472 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( |
| 9370 uint32 immediate_data_size, const cmds::RequestExtensionCHROMIUM& c) { | 9473 uint32 immediate_data_size, |
| 9474 const void* cmd_data) { | |
| 9475 const gles2::cmds::RequestExtensionCHROMIUM& c = | |
| 9476 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); | |
| 9371 Bucket* bucket = GetBucket(c.bucket_id); | 9477 Bucket* bucket = GetBucket(c.bucket_id); |
| 9372 if (!bucket || bucket->size() == 0) { | 9478 if (!bucket || bucket->size() == 0) { |
| 9373 return error::kInvalidArguments; | 9479 return error::kInvalidArguments; |
| 9374 } | 9480 } |
| 9375 std::string feature_str; | 9481 std::string feature_str; |
| 9376 if (!bucket->GetAsString(&feature_str)) { | 9482 if (!bucket->GetAsString(&feature_str)) { |
| 9377 return error::kInvalidArguments; | 9483 return error::kInvalidArguments; |
| 9378 } | 9484 } |
| 9379 | 9485 |
| 9380 bool desire_webgl_glsl_validation = | 9486 bool desire_webgl_glsl_validation = |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 9405 shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; | 9511 shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; |
| 9406 InitializeShaderTranslator(); | 9512 InitializeShaderTranslator(); |
| 9407 } | 9513 } |
| 9408 | 9514 |
| 9409 UpdateCapabilities(); | 9515 UpdateCapabilities(); |
| 9410 | 9516 |
| 9411 return error::kNoError; | 9517 return error::kNoError; |
| 9412 } | 9518 } |
| 9413 | 9519 |
| 9414 error::Error GLES2DecoderImpl::HandleGetMultipleIntegervCHROMIUM( | 9520 error::Error GLES2DecoderImpl::HandleGetMultipleIntegervCHROMIUM( |
| 9415 uint32 immediate_data_size, const cmds::GetMultipleIntegervCHROMIUM& c) { | 9521 uint32 immediate_data_size, |
| 9522 const void* cmd_data) { | |
| 9523 const gles2::cmds::GetMultipleIntegervCHROMIUM& c = | |
| 9524 *static_cast<const gles2::cmds::GetMultipleIntegervCHROMIUM*>(cmd_data); | |
| 9416 GLuint count = c.count; | 9525 GLuint count = c.count; |
| 9417 uint32 pnames_size; | 9526 uint32 pnames_size; |
| 9418 if (!SafeMultiplyUint32(count, sizeof(GLenum), &pnames_size)) { | 9527 if (!SafeMultiplyUint32(count, sizeof(GLenum), &pnames_size)) { |
| 9419 return error::kOutOfBounds; | 9528 return error::kOutOfBounds; |
| 9420 } | 9529 } |
| 9421 const GLenum* pnames = GetSharedMemoryAs<const GLenum*>( | 9530 const GLenum* pnames = GetSharedMemoryAs<const GLenum*>( |
| 9422 c.pnames_shm_id, c.pnames_shm_offset, pnames_size); | 9531 c.pnames_shm_id, c.pnames_shm_offset, pnames_size); |
| 9423 if (pnames == NULL) { | 9532 if (pnames == NULL) { |
| 9424 return error::kOutOfBounds; | 9533 return error::kOutOfBounds; |
| 9425 } | 9534 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9484 | 9593 |
| 9485 // Just to verify. Should this be a DCHECK? | 9594 // Just to verify. Should this be a DCHECK? |
| 9486 if (static_cast<uint32>(results - start) != num_results) { | 9595 if (static_cast<uint32>(results - start) != num_results) { |
| 9487 return error::kOutOfBounds; | 9596 return error::kOutOfBounds; |
| 9488 } | 9597 } |
| 9489 | 9598 |
| 9490 return error::kNoError; | 9599 return error::kNoError; |
| 9491 } | 9600 } |
| 9492 | 9601 |
| 9493 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( | 9602 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( |
| 9494 uint32 immediate_data_size, const cmds::GetProgramInfoCHROMIUM& c) { | 9603 uint32 immediate_data_size, |
| 9604 const void* cmd_data) { | |
| 9605 const gles2::cmds::GetProgramInfoCHROMIUM& c = | |
| 9606 *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); | |
| 9495 GLuint program_id = static_cast<GLuint>(c.program); | 9607 GLuint program_id = static_cast<GLuint>(c.program); |
| 9496 uint32 bucket_id = c.bucket_id; | 9608 uint32 bucket_id = c.bucket_id; |
| 9497 Bucket* bucket = CreateBucket(bucket_id); | 9609 Bucket* bucket = CreateBucket(bucket_id); |
| 9498 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. | 9610 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. |
| 9499 Program* program = NULL; | 9611 Program* program = NULL; |
| 9500 program = GetProgram(program_id); | 9612 program = GetProgram(program_id); |
| 9501 if (!program || !program->IsValid()) { | 9613 if (!program || !program->IsValid()) { |
| 9502 return error::kNoError; | 9614 return error::kNoError; |
| 9503 } | 9615 } |
| 9504 program->GetProgramInfo(program_manager(), bucket); | 9616 program->GetProgramInfo(program_manager(), bucket); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9553 if (reset_status_ != GL_NO_ERROR) { | 9665 if (reset_status_ != GL_NO_ERROR) { |
| 9554 return; | 9666 return; |
| 9555 } | 9667 } |
| 9556 | 9668 |
| 9557 // Marks this context as lost. | 9669 // Marks this context as lost. |
| 9558 reset_status_ = reset_status; | 9670 reset_status_ = reset_status; |
| 9559 current_decoder_error_ = error::kLostContext; | 9671 current_decoder_error_ = error::kLostContext; |
| 9560 } | 9672 } |
| 9561 | 9673 |
| 9562 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( | 9674 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( |
| 9563 uint32 immediate_data_size, const cmds::InsertSyncPointCHROMIUM& c) { | 9675 uint32 immediate_data_size, |
| 9676 const void* cmd_data) { | |
| 9564 return error::kUnknownCommand; | 9677 return error::kUnknownCommand; |
| 9565 } | 9678 } |
| 9566 | 9679 |
| 9567 error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( | 9680 error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( |
| 9568 uint32 immediate_data_size, const cmds::WaitSyncPointCHROMIUM& c) { | 9681 uint32 immediate_data_size, |
| 9682 const void* cmd_data) { | |
| 9683 const gles2::cmds::WaitSyncPointCHROMIUM& c = | |
| 9684 *static_cast<const gles2::cmds::WaitSyncPointCHROMIUM*>(cmd_data); | |
| 9569 group_->mailbox_manager()->PullTextureUpdates(); | 9685 group_->mailbox_manager()->PullTextureUpdates(); |
| 9570 if (wait_sync_point_callback_.is_null()) | 9686 if (wait_sync_point_callback_.is_null()) |
| 9571 return error::kNoError; | 9687 return error::kNoError; |
| 9572 | 9688 |
| 9573 return wait_sync_point_callback_.Run(c.sync_point) ? | 9689 return wait_sync_point_callback_.Run(c.sync_point) ? |
| 9574 error::kNoError : error::kDeferCommandUntilLater; | 9690 error::kNoError : error::kDeferCommandUntilLater; |
| 9575 } | 9691 } |
| 9576 | 9692 |
| 9577 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( | 9693 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( |
| 9578 uint32 immediate_data_size, const cmds::DiscardBackbufferCHROMIUM& c) { | 9694 uint32 immediate_data_size, |
| 9695 const void* cmd_data) { | |
| 9579 if (surface_->DeferDraws()) | 9696 if (surface_->DeferDraws()) |
| 9580 return error::kDeferCommandUntilLater; | 9697 return error::kDeferCommandUntilLater; |
| 9581 if (!surface_->SetBackbufferAllocation(false)) | 9698 if (!surface_->SetBackbufferAllocation(false)) |
| 9582 return error::kLostContext; | 9699 return error::kLostContext; |
| 9583 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; | 9700 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; |
| 9584 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; | 9701 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; |
| 9585 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; | 9702 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; |
| 9586 return error::kNoError; | 9703 return error::kNoError; |
| 9587 } | 9704 } |
| 9588 | 9705 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9651 } | 9768 } |
| 9652 | 9769 |
| 9653 void GLES2DecoderImpl::PerformIdleWork() { | 9770 void GLES2DecoderImpl::PerformIdleWork() { |
| 9654 ProcessPendingReadPixels(); | 9771 ProcessPendingReadPixels(); |
| 9655 if (!async_pixel_transfer_manager_->NeedsProcessMorePendingTransfers()) | 9772 if (!async_pixel_transfer_manager_->NeedsProcessMorePendingTransfers()) |
| 9656 return; | 9773 return; |
| 9657 async_pixel_transfer_manager_->ProcessMorePendingTransfers(); | 9774 async_pixel_transfer_manager_->ProcessMorePendingTransfers(); |
| 9658 ProcessFinishedAsyncTransfers(); | 9775 ProcessFinishedAsyncTransfers(); |
| 9659 } | 9776 } |
| 9660 | 9777 |
| 9661 error::Error GLES2DecoderImpl::HandleBeginQueryEXT( | 9778 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32 immediate_data_size, |
| 9662 uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { | 9779 const void* cmd_data) { |
| 9780 const gles2::cmds::BeginQueryEXT& c = | |
| 9781 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); | |
| 9663 GLenum target = static_cast<GLenum>(c.target); | 9782 GLenum target = static_cast<GLenum>(c.target); |
| 9664 GLuint client_id = static_cast<GLuint>(c.id); | 9783 GLuint client_id = static_cast<GLuint>(c.id); |
| 9665 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 9784 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); |
| 9666 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 9785 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); |
| 9667 | 9786 |
| 9668 switch (target) { | 9787 switch (target) { |
| 9669 case GL_COMMANDS_ISSUED_CHROMIUM: | 9788 case GL_COMMANDS_ISSUED_CHROMIUM: |
| 9670 case GL_LATENCY_QUERY_CHROMIUM: | 9789 case GL_LATENCY_QUERY_CHROMIUM: |
| 9671 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: | 9790 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: |
| 9672 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: | 9791 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9724 } | 9843 } |
| 9725 | 9844 |
| 9726 if (!query_manager_->BeginQuery(query)) { | 9845 if (!query_manager_->BeginQuery(query)) { |
| 9727 return error::kOutOfBounds; | 9846 return error::kOutOfBounds; |
| 9728 } | 9847 } |
| 9729 | 9848 |
| 9730 state_.current_queries[target] = query; | 9849 state_.current_queries[target] = query; |
| 9731 return error::kNoError; | 9850 return error::kNoError; |
| 9732 } | 9851 } |
| 9733 | 9852 |
| 9734 error::Error GLES2DecoderImpl::HandleEndQueryEXT( | 9853 error::Error GLES2DecoderImpl::HandleEndQueryEXT(uint32 immediate_data_size, |
| 9735 uint32 immediate_data_size, const cmds::EndQueryEXT& c) { | 9854 const void* cmd_data) { |
| 9855 const gles2::cmds::EndQueryEXT& c = | |
| 9856 *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); | |
| 9736 GLenum target = static_cast<GLenum>(c.target); | 9857 GLenum target = static_cast<GLenum>(c.target); |
| 9737 uint32 submit_count = static_cast<GLuint>(c.submit_count); | 9858 uint32 submit_count = static_cast<GLuint>(c.submit_count); |
| 9738 ContextState::QueryMap::iterator it = state_.current_queries.find(target); | 9859 ContextState::QueryMap::iterator it = state_.current_queries.find(target); |
| 9739 | 9860 |
| 9740 if (it == state_.current_queries.end()) { | 9861 if (it == state_.current_queries.end()) { |
| 9741 LOCAL_SET_GL_ERROR( | 9862 LOCAL_SET_GL_ERROR( |
| 9742 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); | 9863 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); |
| 9743 return error::kNoError; | 9864 return error::kNoError; |
| 9744 } | 9865 } |
| 9745 | 9866 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10285 texture_ref, target, ii, format, | 10406 texture_ref, target, ii, format, |
| 10286 level_width, level_height, 1, 0, format, type, false); | 10407 level_width, level_height, 1, 0, format, type, false); |
| 10287 level_width = std::max(1, level_width >> 1); | 10408 level_width = std::max(1, level_width >> 1); |
| 10288 level_height = std::max(1, level_height >> 1); | 10409 level_height = std::max(1, level_height >> 1); |
| 10289 } | 10410 } |
| 10290 texture->SetImmutable(true); | 10411 texture->SetImmutable(true); |
| 10291 } | 10412 } |
| 10292 } | 10413 } |
| 10293 | 10414 |
| 10294 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( | 10415 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( |
| 10295 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { | 10416 uint32 immediate_data_size, |
| 10417 const void* cmd_data) { | |
| 10296 return error::kUnknownCommand; | 10418 return error::kUnknownCommand; |
| 10297 } | 10419 } |
| 10298 | 10420 |
| 10299 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, | 10421 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, |
| 10300 const GLbyte* data) { | 10422 const GLbyte* data) { |
| 10301 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", | 10423 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", |
| 10302 "context", logger_.GetLogPrefix(), | 10424 "context", logger_.GetLogPrefix(), |
| 10303 "mailbox[0]", static_cast<unsigned char>(data[0])); | 10425 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 10304 | 10426 |
| 10305 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 10427 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10405 unit.bound_texture_rectangle_arb = texture_ref; | 10527 unit.bound_texture_rectangle_arb = texture_ref; |
| 10406 break; | 10528 break; |
| 10407 default: | 10529 default: |
| 10408 NOTREACHED(); // Validation should prevent us getting here. | 10530 NOTREACHED(); // Validation should prevent us getting here. |
| 10409 break; | 10531 break; |
| 10410 } | 10532 } |
| 10411 } | 10533 } |
| 10412 | 10534 |
| 10413 error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate( | 10535 error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate( |
| 10414 uint32_t immediate_data_size, | 10536 uint32_t immediate_data_size, |
| 10415 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate& c) { | 10537 const void* cmd_data) { |
| 10538 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate& c = | |
| 10539 *static_cast< | |
| 10540 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate*>( | |
| 10541 cmd_data); | |
| 10416 GLenum target = static_cast<GLenum>(c.target); | 10542 GLenum target = static_cast<GLenum>(c.target); |
| 10417 uint32_t data_size; | 10543 uint32_t data_size; |
| 10418 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | 10544 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { |
| 10419 return error::kOutOfBounds; | 10545 return error::kOutOfBounds; |
| 10420 } | 10546 } |
| 10421 if (data_size > immediate_data_size) { | 10547 if (data_size > immediate_data_size) { |
| 10422 return error::kOutOfBounds; | 10548 return error::kOutOfBounds; |
| 10423 } | 10549 } |
| 10424 const GLbyte* mailbox = | 10550 const GLbyte* mailbox = |
| 10425 GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size); | 10551 GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10578 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); | 10704 "GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM", GetErrorState()); |
| 10579 gl_image->ReleaseTexImage(target); | 10705 gl_image->ReleaseTexImage(target); |
| 10580 } | 10706 } |
| 10581 | 10707 |
| 10582 texture_manager()->SetLevelInfo( | 10708 texture_manager()->SetLevelInfo( |
| 10583 texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, | 10709 texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, |
| 10584 GL_RGBA, GL_UNSIGNED_BYTE, false); | 10710 GL_RGBA, GL_UNSIGNED_BYTE, false); |
| 10585 } | 10711 } |
| 10586 | 10712 |
| 10587 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( | 10713 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( |
| 10588 uint32 immediate_data_size, const cmds::TraceBeginCHROMIUM& c) { | 10714 uint32 immediate_data_size, |
| 10715 const void* cmd_data) { | |
| 10716 const gles2::cmds::TraceBeginCHROMIUM& c = | |
| 10717 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); | |
| 10589 Bucket* bucket = GetBucket(c.bucket_id); | 10718 Bucket* bucket = GetBucket(c.bucket_id); |
| 10590 if (!bucket || bucket->size() == 0) { | 10719 if (!bucket || bucket->size() == 0) { |
| 10591 return error::kInvalidArguments; | 10720 return error::kInvalidArguments; |
| 10592 } | 10721 } |
| 10593 std::string command_name; | 10722 std::string command_name; |
| 10594 if (!bucket->GetAsString(&command_name)) { | 10723 if (!bucket->GetAsString(&command_name)) { |
| 10595 return error::kInvalidArguments; | 10724 return error::kInvalidArguments; |
| 10596 } | 10725 } |
| 10597 TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this); | 10726 TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this); |
| 10598 if (!gpu_tracer_->Begin(command_name, kTraceCHROMIUM)) { | 10727 if (!gpu_tracer_->Begin(command_name, kTraceCHROMIUM)) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10756 new AsyncUploadTokenCompletionObserver(async_upload_token)); | 10885 new AsyncUploadTokenCompletionObserver(async_upload_token)); |
| 10757 | 10886 |
| 10758 return base::Bind( | 10887 return base::Bind( |
| 10759 &AsyncPixelTransferManager::AsyncNotifyCompletion, | 10888 &AsyncPixelTransferManager::AsyncNotifyCompletion, |
| 10760 base::Unretained(GetAsyncPixelTransferManager()), | 10889 base::Unretained(GetAsyncPixelTransferManager()), |
| 10761 mem_params, | 10890 mem_params, |
| 10762 observer); | 10891 observer); |
| 10763 } | 10892 } |
| 10764 | 10893 |
| 10765 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( | 10894 error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( |
| 10766 uint32 immediate_data_size, const cmds::AsyncTexImage2DCHROMIUM& c) { | 10895 uint32 immediate_data_size, |
| 10896 const void* cmd_data) { | |
| 10897 const gles2::cmds::AsyncTexImage2DCHROMIUM& c = | |
| 10898 *static_cast<const gles2::cmds::AsyncTexImage2DCHROMIUM*>(cmd_data); | |
| 10767 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); | 10899 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM"); |
| 10768 GLenum target = static_cast<GLenum>(c.target); | 10900 GLenum target = static_cast<GLenum>(c.target); |
| 10769 GLint level = static_cast<GLint>(c.level); | 10901 GLint level = static_cast<GLint>(c.level); |
| 10770 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 10902 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 10771 GLsizei width = static_cast<GLsizei>(c.width); | 10903 GLsizei width = static_cast<GLsizei>(c.width); |
| 10772 GLsizei height = static_cast<GLsizei>(c.height); | 10904 GLsizei height = static_cast<GLsizei>(c.height); |
| 10773 GLint border = static_cast<GLint>(c.border); | 10905 GLint border = static_cast<GLint>(c.border); |
| 10774 GLenum format = static_cast<GLenum>(c.format); | 10906 GLenum format = static_cast<GLenum>(c.format); |
| 10775 GLenum type = static_cast<GLenum>(c.type); | 10907 GLenum type = static_cast<GLenum>(c.type); |
| 10776 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | 10908 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10860 // The callback is only invoked if the transfer delegate still | 10992 // The callback is only invoked if the transfer delegate still |
| 10861 // exists, which implies through manager->texture_ref->state | 10993 // exists, which implies through manager->texture_ref->state |
| 10862 // ownership that both of these pointers are valid. | 10994 // ownership that both of these pointers are valid. |
| 10863 base::Unretained(texture_manager()), | 10995 base::Unretained(texture_manager()), |
| 10864 base::Unretained(texture_ref), | 10996 base::Unretained(texture_ref), |
| 10865 tex_params)); | 10997 tex_params)); |
| 10866 return error::kNoError; | 10998 return error::kNoError; |
| 10867 } | 10999 } |
| 10868 | 11000 |
| 10869 error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM( | 11001 error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM( |
| 10870 uint32 immediate_data_size, const cmds::AsyncTexSubImage2DCHROMIUM& c) { | 11002 uint32 immediate_data_size, |
| 11003 const void* cmd_data) { | |
| 11004 const gles2::cmds::AsyncTexSubImage2DCHROMIUM& c = | |
| 11005 *static_cast<const gles2::cmds::AsyncTexSubImage2DCHROMIUM*>(cmd_data); | |
| 10871 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM"); | 11006 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM"); |
| 10872 GLenum target = static_cast<GLenum>(c.target); | 11007 GLenum target = static_cast<GLenum>(c.target); |
| 10873 GLint level = static_cast<GLint>(c.level); | 11008 GLint level = static_cast<GLint>(c.level); |
| 10874 GLint xoffset = static_cast<GLint>(c.xoffset); | 11009 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 10875 GLint yoffset = static_cast<GLint>(c.yoffset); | 11010 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 10876 GLsizei width = static_cast<GLsizei>(c.width); | 11011 GLsizei width = static_cast<GLsizei>(c.width); |
| 10877 GLsizei height = static_cast<GLsizei>(c.height); | 11012 GLsizei height = static_cast<GLsizei>(c.height); |
| 10878 GLenum format = static_cast<GLenum>(c.format); | 11013 GLenum format = static_cast<GLenum>(c.format); |
| 10879 GLenum type = static_cast<GLenum>(c.type); | 11014 GLenum type = static_cast<GLenum>(c.type); |
| 10880 uint32 async_upload_token = static_cast<uint32>(c.async_upload_token); | 11015 uint32 async_upload_token = static_cast<uint32>(c.async_upload_token); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10957 delegate = async_pixel_transfer_manager_->CreatePixelTransferDelegate( | 11092 delegate = async_pixel_transfer_manager_->CreatePixelTransferDelegate( |
| 10958 texture_ref, define_params); | 11093 texture_ref, define_params); |
| 10959 texture->SetImmutable(true); | 11094 texture->SetImmutable(true); |
| 10960 } | 11095 } |
| 10961 | 11096 |
| 10962 delegate->AsyncTexSubImage2D(tex_params, mem_params); | 11097 delegate->AsyncTexSubImage2D(tex_params, mem_params); |
| 10963 return error::kNoError; | 11098 return error::kNoError; |
| 10964 } | 11099 } |
| 10965 | 11100 |
| 10966 error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM( | 11101 error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM( |
| 10967 uint32 immediate_data_size, const cmds::WaitAsyncTexImage2DCHROMIUM& c) { | 11102 uint32 immediate_data_size, |
| 11103 const void* cmd_data) { | |
| 11104 const gles2::cmds::WaitAsyncTexImage2DCHROMIUM& c = | |
| 11105 *static_cast<const gles2::cmds::WaitAsyncTexImage2DCHROMIUM*>(cmd_data); | |
| 10968 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); | 11106 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); |
| 10969 GLenum target = static_cast<GLenum>(c.target); | 11107 GLenum target = static_cast<GLenum>(c.target); |
| 10970 | 11108 |
| 10971 if (GL_TEXTURE_2D != target) { | 11109 if (GL_TEXTURE_2D != target) { |
| 10972 LOCAL_SET_GL_ERROR( | 11110 LOCAL_SET_GL_ERROR( |
| 10973 GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target"); | 11111 GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target"); |
| 10974 return error::kNoError; | 11112 return error::kNoError; |
| 10975 } | 11113 } |
| 10976 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 11114 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| 10977 &state_, target); | 11115 &state_, target); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 10988 GL_INVALID_OPERATION, | 11126 GL_INVALID_OPERATION, |
| 10989 "glWaitAsyncTexImage2DCHROMIUM", "No async transfer started"); | 11127 "glWaitAsyncTexImage2DCHROMIUM", "No async transfer started"); |
| 10990 return error::kNoError; | 11128 return error::kNoError; |
| 10991 } | 11129 } |
| 10992 delegate->WaitForTransferCompletion(); | 11130 delegate->WaitForTransferCompletion(); |
| 10993 ProcessFinishedAsyncTransfers(); | 11131 ProcessFinishedAsyncTransfers(); |
| 10994 return error::kNoError; | 11132 return error::kNoError; |
| 10995 } | 11133 } |
| 10996 | 11134 |
| 10997 error::Error GLES2DecoderImpl::HandleWaitAllAsyncTexImage2DCHROMIUM( | 11135 error::Error GLES2DecoderImpl::HandleWaitAllAsyncTexImage2DCHROMIUM( |
| 10998 uint32 immediate_data_size, const cmds::WaitAllAsyncTexImage2DCHROMIUM& c) { | 11136 uint32 immediate_data_size, |
| 11137 const void* data) { | |
| 10999 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); | 11138 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM"); |
| 11000 | 11139 |
| 11001 GetAsyncPixelTransferManager()->WaitAllAsyncTexImage2D(); | 11140 GetAsyncPixelTransferManager()->WaitAllAsyncTexImage2D(); |
| 11002 ProcessFinishedAsyncTransfers(); | 11141 ProcessFinishedAsyncTransfers(); |
| 11003 return error::kNoError; | 11142 return error::kNoError; |
| 11004 } | 11143 } |
| 11005 | 11144 |
| 11006 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( | 11145 void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( |
| 11007 TextureRef* texture_ref) { | 11146 TextureRef* texture_ref) { |
| 11008 Texture* texture = texture_ref->texture(); | 11147 Texture* texture = texture_ref->texture(); |
| 11009 DoDidUseTexImageIfNeeded(texture, texture->target()); | 11148 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 11010 } | 11149 } |
| 11011 | 11150 |
| 11012 void GLES2DecoderImpl::OnOutOfMemoryError() { | 11151 void GLES2DecoderImpl::OnOutOfMemoryError() { |
| 11013 if (lose_context_when_out_of_memory_) { | 11152 if (lose_context_when_out_of_memory_) { |
| 11014 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 11153 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 11015 LoseContext(GL_GUILTY_CONTEXT_RESET_ARB); | 11154 LoseContext(GL_GUILTY_CONTEXT_RESET_ARB); |
| 11016 } | 11155 } |
| 11017 } | 11156 } |
| 11018 | 11157 |
| 11019 // Include the auto-generated part of this file. We split this because it means | 11158 // Include the auto-generated part of this file. We split this because it means |
| 11020 // we can easily edit the non-auto generated parts right here in this file | 11159 // we can easily edit the non-auto generated parts right here in this file |
| 11021 // instead of having to edit some template or the code generator. | 11160 // instead of having to edit some template or the code generator. |
| 11022 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11161 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 11023 | 11162 |
| 11024 } // namespace gles2 | 11163 } // namespace gles2 |
| 11025 } // namespace gpu | 11164 } // namespace gpu |
| OLD | NEW |