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