| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 virtual bool MakeCurrent(); | 500 virtual bool MakeCurrent(); |
| 501 virtual void ReleaseCurrent(); | 501 virtual void ReleaseCurrent(); |
| 502 virtual GLES2Util* GetGLES2Util() { return &util_; } | 502 virtual GLES2Util* GetGLES2Util() { return &util_; } |
| 503 virtual gfx::GLContext* GetGLContext() { return context_.get(); } | 503 virtual gfx::GLContext* GetGLContext() { return context_.get(); } |
| 504 virtual ContextGroup* GetContextGroup() { return group_.get(); } | 504 virtual ContextGroup* GetContextGroup() { return group_.get(); } |
| 505 virtual QueryManager* GetQueryManager() { return query_manager_.get(); } | 505 virtual QueryManager* GetQueryManager() { return query_manager_.get(); } |
| 506 virtual bool ProcessPendingQueries(); | 506 virtual bool ProcessPendingQueries(); |
| 507 | 507 |
| 508 virtual void SetGLError( | 508 virtual void SetGLError( |
| 509 GLenum error, const char* function_name, const char* msg); | 509 GLenum error, const char* function_name, const char* msg); |
| 510 virtual void SetGLErrorInvalidEnum( |
| 511 const char* function_name, GLenum value, const char* label); |
| 510 virtual void SetResizeCallback( | 512 virtual void SetResizeCallback( |
| 511 const base::Callback<void(gfx::Size)>& callback); | 513 const base::Callback<void(gfx::Size)>& callback); |
| 512 | 514 |
| 513 virtual void SetMsgCallback(const MsgCallback& callback); | 515 virtual void SetMsgCallback(const MsgCallback& callback); |
| 514 | 516 |
| 515 virtual void SetStreamTextureManager(StreamTextureManager* manager); | 517 virtual void SetStreamTextureManager(StreamTextureManager* manager); |
| 516 virtual bool GetServiceTextureId(uint32 client_texture_id, | 518 virtual bool GetServiceTextureId(uint32 client_texture_id, |
| 517 uint32* service_texture_id); | 519 uint32* service_texture_id); |
| 518 | 520 |
| 519 virtual uint32 GetGLError() OVERRIDE; | 521 virtual uint32 GetGLError() OVERRIDE; |
| (...skipping 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 } | 3292 } |
| 3291 | 3293 |
| 3292 void GLES2DecoderImpl::DoFlush() { | 3294 void GLES2DecoderImpl::DoFlush() { |
| 3293 glFlush(); | 3295 glFlush(); |
| 3294 ProcessPendingQueries(); | 3296 ProcessPendingQueries(); |
| 3295 } | 3297 } |
| 3296 | 3298 |
| 3297 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { | 3299 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { |
| 3298 GLuint texture_index = texture_unit - GL_TEXTURE0; | 3300 GLuint texture_index = texture_unit - GL_TEXTURE0; |
| 3299 if (texture_index >= group_->max_texture_units()) { | 3301 if (texture_index >= group_->max_texture_units()) { |
| 3300 SetGLError( | 3302 SetGLErrorInvalidEnum( |
| 3301 GL_INVALID_ENUM, "glActiveTexture", "texture_unit out of range."); | 3303 "glActiveTexture", texture_unit, "texture_unit"); |
| 3302 return; | 3304 return; |
| 3303 } | 3305 } |
| 3304 active_texture_unit_ = texture_index; | 3306 active_texture_unit_ = texture_index; |
| 3305 glActiveTexture(texture_unit); | 3307 glActiveTexture(texture_unit); |
| 3306 } | 3308 } |
| 3307 | 3309 |
| 3308 void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { | 3310 void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { |
| 3309 BufferManager::BufferInfo* info = NULL; | 3311 BufferManager::BufferInfo* info = NULL; |
| 3310 GLuint service_id = 0; | 3312 GLuint service_id = 0; |
| 3311 if (client_id != 0) { | 3313 if (client_id != 0) { |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4761 void GLES2DecoderImpl::DoTexParameterf( | 4763 void GLES2DecoderImpl::DoTexParameterf( |
| 4762 GLenum target, GLenum pname, GLfloat param) { | 4764 GLenum target, GLenum pname, GLfloat param) { |
| 4763 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 4765 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
| 4764 if (!info) { | 4766 if (!info) { |
| 4765 SetGLError(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); | 4767 SetGLError(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); |
| 4766 return; | 4768 return; |
| 4767 } | 4769 } |
| 4768 | 4770 |
| 4769 if (!texture_manager()->SetParameter( | 4771 if (!texture_manager()->SetParameter( |
| 4770 info, pname, static_cast<GLint>(param))) { | 4772 info, pname, static_cast<GLint>(param))) { |
| 4771 SetGLError(GL_INVALID_ENUM, "glTexParameterf", "param GL_INVALID_ENUM"); | 4773 SetGLErrorInvalidEnum("glTexParameterf", pname, "pname"); |
| 4772 return; | 4774 return; |
| 4773 } | 4775 } |
| 4774 glTexParameterf(target, pname, param); | 4776 glTexParameterf(target, pname, param); |
| 4775 } | 4777 } |
| 4776 | 4778 |
| 4777 void GLES2DecoderImpl::DoTexParameteri( | 4779 void GLES2DecoderImpl::DoTexParameteri( |
| 4778 GLenum target, GLenum pname, GLint param) { | 4780 GLenum target, GLenum pname, GLint param) { |
| 4779 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 4781 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
| 4780 if (!info) { | 4782 if (!info) { |
| 4781 SetGLError(GL_INVALID_VALUE, "glTexParameteri", "unknown texture"); | 4783 SetGLError(GL_INVALID_VALUE, "glTexParameteri", "unknown texture"); |
| 4782 return; | 4784 return; |
| 4783 } | 4785 } |
| 4784 | 4786 |
| 4785 if (!texture_manager()->SetParameter(info, pname, param)) { | 4787 if (!texture_manager()->SetParameter(info, pname, param)) { |
| 4786 SetGLError(GL_INVALID_ENUM, "glTexParameteri", "param GL_INVALID_ENUM"); | 4788 SetGLErrorInvalidEnum("glTexParameteri", pname, "pname"); |
| 4787 return; | 4789 return; |
| 4788 } | 4790 } |
| 4789 glTexParameteri(target, pname, param); | 4791 glTexParameteri(target, pname, param); |
| 4790 } | 4792 } |
| 4791 | 4793 |
| 4792 void GLES2DecoderImpl::DoTexParameterfv( | 4794 void GLES2DecoderImpl::DoTexParameterfv( |
| 4793 GLenum target, GLenum pname, const GLfloat* params) { | 4795 GLenum target, GLenum pname, const GLfloat* params) { |
| 4794 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 4796 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
| 4795 if (!info) { | 4797 if (!info) { |
| 4796 SetGLError(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); | 4798 SetGLError(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); |
| 4797 return; | 4799 return; |
| 4798 } | 4800 } |
| 4799 | 4801 |
| 4800 if (!texture_manager()->SetParameter( | 4802 if (!texture_manager()->SetParameter( |
| 4801 info, pname, static_cast<GLint>(params[0]))) { | 4803 info, pname, static_cast<GLint>(params[0]))) { |
| 4802 SetGLError(GL_INVALID_ENUM, "glTexParameterfv", "param GL_INVALID_ENUM"); | 4804 SetGLErrorInvalidEnum("glTexParameterfv", pname, "pname"); |
| 4803 return; | 4805 return; |
| 4804 } | 4806 } |
| 4805 glTexParameterfv(target, pname, params); | 4807 glTexParameterfv(target, pname, params); |
| 4806 } | 4808 } |
| 4807 | 4809 |
| 4808 void GLES2DecoderImpl::DoTexParameteriv( | 4810 void GLES2DecoderImpl::DoTexParameteriv( |
| 4809 GLenum target, GLenum pname, const GLint* params) { | 4811 GLenum target, GLenum pname, const GLint* params) { |
| 4810 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 4812 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
| 4811 if (!info) { | 4813 if (!info) { |
| 4812 SetGLError(GL_INVALID_VALUE, "glTexParameteriv", "unknown texture"); | 4814 SetGLError(GL_INVALID_VALUE, "glTexParameteriv", "unknown texture"); |
| 4813 return; | 4815 return; |
| 4814 } | 4816 } |
| 4815 | 4817 |
| 4816 if (!texture_manager()->SetParameter(info, pname, *params)) { | 4818 if (!texture_manager()->SetParameter(info, pname, *params)) { |
| 4817 SetGLError(GL_INVALID_ENUM, "glTexParameteriv", "param GL_INVALID_ENUM"); | 4819 SetGLErrorInvalidEnum("glTexParameteriv", pname, "pname"); |
| 4818 return; | 4820 return; |
| 4819 } | 4821 } |
| 4820 glTexParameteriv(target, pname, params); | 4822 glTexParameteriv(target, pname, params); |
| 4821 } | 4823 } |
| 4822 | 4824 |
| 4823 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { | 4825 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { |
| 4824 if (!current_program_) { | 4826 if (!current_program_) { |
| 4825 // The program does not exist. | 4827 // The program does not exist. |
| 4826 SetGLError(GL_INVALID_OPERATION, function_name, "no program in use"); | 4828 SetGLError(GL_INVALID_OPERATION, function_name, "no program in use"); |
| 4827 return false; | 4829 return false; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5110 GLenum error, const char* function_name, const char* msg) { | 5112 GLenum error, const char* function_name, const char* msg) { |
| 5111 if (msg) { | 5113 if (msg) { |
| 5112 last_error_ = msg; | 5114 last_error_ = msg; |
| 5113 LogMessage(GetLogPrefix() + ": " + std::string("GL ERROR :") + | 5115 LogMessage(GetLogPrefix() + ": " + std::string("GL ERROR :") + |
| 5114 GLES2Util::GetStringEnum(error) + " : " + | 5116 GLES2Util::GetStringEnum(error) + " : " + |
| 5115 function_name + ": " + msg); | 5117 function_name + ": " + msg); |
| 5116 } | 5118 } |
| 5117 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); | 5119 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |
| 5118 } | 5120 } |
| 5119 | 5121 |
| 5122 void GLES2DecoderImpl::SetGLErrorInvalidEnum( |
| 5123 const char* function_name, GLenum value, const char* label) { |
| 5124 SetGLError(GL_INVALID_ENUM, function_name, |
| 5125 (std::string(label) + " was " + |
| 5126 GLES2Util::GetStringEnum(value)).c_str()); |
| 5127 } |
| 5128 |
| 5120 const std::string& GLES2DecoderImpl::GetLogPrefix() const { | 5129 const std::string& GLES2DecoderImpl::GetLogPrefix() const { |
| 5121 const std::string& prefix(debug_marker_manager_.GetMarker()); | 5130 const std::string& prefix(debug_marker_manager_.GetMarker()); |
| 5122 return prefix.empty() ? this_in_hex_ : prefix; | 5131 return prefix.empty() ? this_in_hex_ : prefix; |
| 5123 } | 5132 } |
| 5124 | 5133 |
| 5125 void GLES2DecoderImpl::LogMessage(const std::string& msg) { | 5134 void GLES2DecoderImpl::LogMessage(const std::string& msg) { |
| 5126 if (log_message_count_ < kMaxLogMessages || | 5135 if (log_message_count_ < kMaxLogMessages || |
| 5127 CommandLine::ForCurrentProcess()->HasSwitch( | 5136 CommandLine::ForCurrentProcess()->HasSwitch( |
| 5128 switches::kDisableGLErrorLimit)) { | 5137 switches::kDisableGLErrorLimit)) { |
| 5129 ++log_message_count_; | 5138 ++log_message_count_; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5571 error::Error GLES2DecoderImpl::DoDrawArrays( | 5580 error::Error GLES2DecoderImpl::DoDrawArrays( |
| 5572 const char* function_name, | 5581 const char* function_name, |
| 5573 bool instanced, | 5582 bool instanced, |
| 5574 GLenum mode, | 5583 GLenum mode, |
| 5575 GLint first, | 5584 GLint first, |
| 5576 GLsizei count, | 5585 GLsizei count, |
| 5577 GLsizei primcount) { | 5586 GLsizei primcount) { |
| 5578 if (ShouldDeferDraws()) | 5587 if (ShouldDeferDraws()) |
| 5579 return error::kDeferCommandUntilLater; | 5588 return error::kDeferCommandUntilLater; |
| 5580 if (!validators_->draw_mode.IsValid(mode)) { | 5589 if (!validators_->draw_mode.IsValid(mode)) { |
| 5581 SetGLError(GL_INVALID_ENUM, function_name, "mode GL_INVALID_ENUM"); | 5590 SetGLErrorInvalidEnum(function_name, mode, "mode"); |
| 5582 return error::kNoError; | 5591 return error::kNoError; |
| 5583 } | 5592 } |
| 5584 if (count < 0) { | 5593 if (count < 0) { |
| 5585 SetGLError(GL_INVALID_VALUE, function_name, "count < 0"); | 5594 SetGLError(GL_INVALID_VALUE, function_name, "count < 0"); |
| 5586 return error::kNoError; | 5595 return error::kNoError; |
| 5587 } | 5596 } |
| 5588 if (primcount < 0) { | 5597 if (primcount < 0) { |
| 5589 SetGLError(GL_INVALID_VALUE, function_name, "primcount < 0"); | 5598 SetGLError(GL_INVALID_VALUE, function_name, "primcount < 0"); |
| 5590 return error::kNoError; | 5599 return error::kNoError; |
| 5591 } | 5600 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5688 | 5697 |
| 5689 if (count < 0) { | 5698 if (count < 0) { |
| 5690 SetGLError(GL_INVALID_VALUE, function_name, "count < 0"); | 5699 SetGLError(GL_INVALID_VALUE, function_name, "count < 0"); |
| 5691 return error::kNoError; | 5700 return error::kNoError; |
| 5692 } | 5701 } |
| 5693 if (offset < 0) { | 5702 if (offset < 0) { |
| 5694 SetGLError(GL_INVALID_VALUE, function_name, "offset < 0"); | 5703 SetGLError(GL_INVALID_VALUE, function_name, "offset < 0"); |
| 5695 return error::kNoError; | 5704 return error::kNoError; |
| 5696 } | 5705 } |
| 5697 if (!validators_->draw_mode.IsValid(mode)) { | 5706 if (!validators_->draw_mode.IsValid(mode)) { |
| 5698 SetGLError(GL_INVALID_ENUM, function_name, "mode GL_INVALID_ENUM"); | 5707 SetGLErrorInvalidEnum(function_name, mode, "mode"); |
| 5699 return error::kNoError; | 5708 return error::kNoError; |
| 5700 } | 5709 } |
| 5701 if (!validators_->index_type.IsValid(type)) { | 5710 if (!validators_->index_type.IsValid(type)) { |
| 5702 SetGLError(GL_INVALID_ENUM, function_name, "type GL_INVALID_ENUM"); | 5711 SetGLErrorInvalidEnum(function_name, type, "type"); |
| 5703 return error::kNoError; | 5712 return error::kNoError; |
| 5704 } | 5713 } |
| 5705 if (primcount < 0) { | 5714 if (primcount < 0) { |
| 5706 SetGLError(GL_INVALID_VALUE, function_name, "primcount < 0"); | 5715 SetGLError(GL_INVALID_VALUE, function_name, "primcount < 0"); |
| 5707 return error::kNoError; | 5716 return error::kNoError; |
| 5708 } | 5717 } |
| 5709 | 5718 |
| 5710 if (!CheckBoundFramebuffersValid(function_name)) { | 5719 if (!CheckBoundFramebuffersValid(function_name)) { |
| 5711 return error::kNoError; | 5720 return error::kNoError; |
| 5712 } | 5721 } |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6291 } | 6300 } |
| 6292 | 6301 |
| 6293 GLuint indx = c.indx; | 6302 GLuint indx = c.indx; |
| 6294 GLint size = c.size; | 6303 GLint size = c.size; |
| 6295 GLenum type = c.type; | 6304 GLenum type = c.type; |
| 6296 GLboolean normalized = c.normalized; | 6305 GLboolean normalized = c.normalized; |
| 6297 GLsizei stride = c.stride; | 6306 GLsizei stride = c.stride; |
| 6298 GLsizei offset = c.offset; | 6307 GLsizei offset = c.offset; |
| 6299 const void* ptr = reinterpret_cast<const void*>(offset); | 6308 const void* ptr = reinterpret_cast<const void*>(offset); |
| 6300 if (!validators_->vertex_attrib_type.IsValid(type)) { | 6309 if (!validators_->vertex_attrib_type.IsValid(type)) { |
| 6301 SetGLError(GL_INVALID_ENUM, | 6310 SetGLErrorInvalidEnum("glVertexAttribPointer", type, "type"); |
| 6302 "glVertexAttribPointer", "type GL_INVALID_ENUM"); | |
| 6303 return error::kNoError; | 6311 return error::kNoError; |
| 6304 } | 6312 } |
| 6305 if (!validators_->vertex_attrib_size.IsValid(size)) { | 6313 if (!validators_->vertex_attrib_size.IsValid(size)) { |
| 6306 SetGLError(GL_INVALID_VALUE, | 6314 SetGLError(GL_INVALID_VALUE, |
| 6307 "glVertexAttribPointer", "size GL_INVALID_VALUE"); | 6315 "glVertexAttribPointer", "size GL_INVALID_VALUE"); |
| 6308 return error::kNoError; | 6316 return error::kNoError; |
| 6309 } | 6317 } |
| 6310 if (indx >= group_->max_vertex_attribs()) { | 6318 if (indx >= group_->max_vertex_attribs()) { |
| 6311 SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer", "index out of range"); | 6319 SetGLError(GL_INVALID_VALUE, "glVertexAttribPointer", "index out of range"); |
| 6312 return error::kNoError; | 6320 return error::kNoError; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6403 } | 6411 } |
| 6404 void* pixels = GetSharedMemoryAs<void*>( | 6412 void* pixels = GetSharedMemoryAs<void*>( |
| 6405 c.pixels_shm_id, c.pixels_shm_offset, pixels_size); | 6413 c.pixels_shm_id, c.pixels_shm_offset, pixels_size); |
| 6406 Result* result = GetSharedMemoryAs<Result*>( | 6414 Result* result = GetSharedMemoryAs<Result*>( |
| 6407 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 6415 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 6408 if (!pixels || !result) { | 6416 if (!pixels || !result) { |
| 6409 return error::kOutOfBounds; | 6417 return error::kOutOfBounds; |
| 6410 } | 6418 } |
| 6411 | 6419 |
| 6412 if (!validators_->read_pixel_format.IsValid(format)) { | 6420 if (!validators_->read_pixel_format.IsValid(format)) { |
| 6413 SetGLError(GL_INVALID_ENUM, "glReadPixels", "format GL_INVALID_ENUM"); | 6421 SetGLErrorInvalidEnum("glReadPixels", format, "format"); |
| 6414 return error::kNoError; | 6422 return error::kNoError; |
| 6415 } | 6423 } |
| 6416 if (!validators_->pixel_type.IsValid(type)) { | 6424 if (!validators_->pixel_type.IsValid(type)) { |
| 6417 SetGLError(GL_INVALID_ENUM, "glReadPixels", "type GL_INVALID_ENUM"); | 6425 SetGLErrorInvalidEnum("glReadPixels", type, "type"); |
| 6418 return error::kNoError; | 6426 return error::kNoError; |
| 6419 } | 6427 } |
| 6420 if (width == 0 || height == 0) { | 6428 if (width == 0 || height == 0) { |
| 6421 return error::kNoError; | 6429 return error::kNoError; |
| 6422 } | 6430 } |
| 6423 | 6431 |
| 6424 // Get the size of the current fbo or backbuffer. | 6432 // Get the size of the current fbo or backbuffer. |
| 6425 gfx::Size max_size = GetBoundReadFrameBufferSize(); | 6433 gfx::Size max_size = GetBoundReadFrameBufferSize(); |
| 6426 | 6434 |
| 6427 GLint max_x; | 6435 GLint max_x; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6532 } | 6540 } |
| 6533 | 6541 |
| 6534 return error::kNoError; | 6542 return error::kNoError; |
| 6535 } | 6543 } |
| 6536 | 6544 |
| 6537 error::Error GLES2DecoderImpl::HandlePixelStorei( | 6545 error::Error GLES2DecoderImpl::HandlePixelStorei( |
| 6538 uint32 immediate_data_size, const gles2::PixelStorei& c) { | 6546 uint32 immediate_data_size, const gles2::PixelStorei& c) { |
| 6539 GLenum pname = c.pname; | 6547 GLenum pname = c.pname; |
| 6540 GLenum param = c.param; | 6548 GLenum param = c.param; |
| 6541 if (!validators_->pixel_store.IsValid(pname)) { | 6549 if (!validators_->pixel_store.IsValid(pname)) { |
| 6542 SetGLError(GL_INVALID_ENUM, "glPixelStorei", "pname GL_INVALID_ENUM"); | 6550 SetGLErrorInvalidEnum("glPixelStorei", pname, "pname"); |
| 6543 return error::kNoError; | 6551 return error::kNoError; |
| 6544 } | 6552 } |
| 6545 switch (pname) { | 6553 switch (pname) { |
| 6546 case GL_PACK_ALIGNMENT: | 6554 case GL_PACK_ALIGNMENT: |
| 6547 case GL_UNPACK_ALIGNMENT: | 6555 case GL_UNPACK_ALIGNMENT: |
| 6548 if (!validators_->pixel_store_alignment.IsValid(param)) { | 6556 if (!validators_->pixel_store_alignment.IsValid(param)) { |
| 6549 SetGLError(GL_INVALID_VALUE, | 6557 SetGLError(GL_INVALID_VALUE, |
| 6550 "glPixelStore", "param GL_INVALID_VALUE"); | 6558 "glPixelStore", "param GL_INVALID_VALUE"); |
| 6551 return error::kNoError; | 6559 return error::kNoError; |
| 6552 } | 6560 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6736 return error::kInvalidArguments; | 6744 return error::kInvalidArguments; |
| 6737 } | 6745 } |
| 6738 return GetUniformLocationHelper( | 6746 return GetUniformLocationHelper( |
| 6739 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 6747 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 6740 } | 6748 } |
| 6741 | 6749 |
| 6742 error::Error GLES2DecoderImpl::HandleGetString( | 6750 error::Error GLES2DecoderImpl::HandleGetString( |
| 6743 uint32 immediate_data_size, const gles2::GetString& c) { | 6751 uint32 immediate_data_size, const gles2::GetString& c) { |
| 6744 GLenum name = static_cast<GLenum>(c.name); | 6752 GLenum name = static_cast<GLenum>(c.name); |
| 6745 if (!validators_->string_type.IsValid(name)) { | 6753 if (!validators_->string_type.IsValid(name)) { |
| 6746 SetGLError(GL_INVALID_ENUM, "glGetString", "name GL_INVALID_ENUM"); | 6754 SetGLErrorInvalidEnum("glGetString", name, "name"); |
| 6747 return error::kNoError; | 6755 return error::kNoError; |
| 6748 } | 6756 } |
| 6749 const char* gl_str = reinterpret_cast<const char*>(glGetString(name)); | 6757 const char* gl_str = reinterpret_cast<const char*>(glGetString(name)); |
| 6750 const char* str = NULL; | 6758 const char* str = NULL; |
| 6751 std::string extensions; | 6759 std::string extensions; |
| 6752 switch (name) { | 6760 switch (name) { |
| 6753 case GL_VERSION: | 6761 case GL_VERSION: |
| 6754 str = "OpenGL ES 2.0 Chromium"; | 6762 str = "OpenGL ES 2.0 Chromium"; |
| 6755 break; | 6763 break; |
| 6756 case GL_SHADING_LANGUAGE_VERSION: | 6764 case GL_SHADING_LANGUAGE_VERSION: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6789 break; | 6797 break; |
| 6790 } | 6798 } |
| 6791 Bucket* bucket = CreateBucket(c.bucket_id); | 6799 Bucket* bucket = CreateBucket(c.bucket_id); |
| 6792 bucket->SetFromString(str); | 6800 bucket->SetFromString(str); |
| 6793 return error::kNoError; | 6801 return error::kNoError; |
| 6794 } | 6802 } |
| 6795 | 6803 |
| 6796 void GLES2DecoderImpl::DoBufferData( | 6804 void GLES2DecoderImpl::DoBufferData( |
| 6797 GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) { | 6805 GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) { |
| 6798 if (!validators_->buffer_target.IsValid(target)) { | 6806 if (!validators_->buffer_target.IsValid(target)) { |
| 6799 SetGLError(GL_INVALID_ENUM, "glBufferData", "target GL_INVALID_ENUM"); | 6807 SetGLErrorInvalidEnum("glBufferData", target, "target"); |
| 6800 return; | 6808 return; |
| 6801 } | 6809 } |
| 6802 if (!validators_->buffer_usage.IsValid(usage)) { | 6810 if (!validators_->buffer_usage.IsValid(usage)) { |
| 6803 SetGLError(GL_INVALID_ENUM, "glBufferData", "usage GL_INVALID_ENUM"); | 6811 SetGLErrorInvalidEnum("glBufferData", usage, "usage"); |
| 6804 return; | 6812 return; |
| 6805 } | 6813 } |
| 6806 if (size < 0) { | 6814 if (size < 0) { |
| 6807 SetGLError(GL_INVALID_VALUE, "glBufferData", "size < 0"); | 6815 SetGLError(GL_INVALID_VALUE, "glBufferData", "size < 0"); |
| 6808 return; | 6816 return; |
| 6809 } | 6817 } |
| 6810 BufferManager::BufferInfo* info = GetBufferInfoForTarget(target); | 6818 BufferManager::BufferInfo* info = GetBufferInfoForTarget(target); |
| 6811 if (!info) { | 6819 if (!info) { |
| 6812 SetGLError(GL_INVALID_VALUE, "glBufferData", "unknown buffer"); | 6820 SetGLError(GL_INVALID_VALUE, "glBufferData", "unknown buffer"); |
| 6813 return; | 6821 return; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7020 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { | 7028 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { |
| 7021 int num_blocks_across = | 7029 int num_blocks_across = |
| 7022 (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; | 7030 (width + kS3TCBlockWidth - 1) / kS3TCBlockWidth; |
| 7023 int num_blocks_down = | 7031 int num_blocks_down = |
| 7024 (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; | 7032 (height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; |
| 7025 int num_blocks = num_blocks_across * num_blocks_down; | 7033 int num_blocks = num_blocks_across * num_blocks_down; |
| 7026 bytes_required = num_blocks * kS3TCDXT3AndDXT5BlockSize; | 7034 bytes_required = num_blocks * kS3TCDXT3AndDXT5BlockSize; |
| 7027 break; | 7035 break; |
| 7028 } | 7036 } |
| 7029 default: | 7037 default: |
| 7030 SetGLError(GL_INVALID_ENUM, function_name, "invalid format"); | 7038 SetGLErrorInvalidEnum(function_name, format, "format"); |
| 7031 return false; | 7039 return false; |
| 7032 } | 7040 } |
| 7033 | 7041 |
| 7034 if (size != bytes_required) { | 7042 if (size != bytes_required) { |
| 7035 SetGLError( | 7043 SetGLError( |
| 7036 GL_INVALID_VALUE, function_name, "size is not correct for dimensions"); | 7044 GL_INVALID_VALUE, function_name, "size is not correct for dimensions"); |
| 7037 return false; | 7045 return false; |
| 7038 } | 7046 } |
| 7039 | 7047 |
| 7040 return true; | 7048 return true; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7106 GLenum target, | 7114 GLenum target, |
| 7107 GLint level, | 7115 GLint level, |
| 7108 GLenum internal_format, | 7116 GLenum internal_format, |
| 7109 GLsizei width, | 7117 GLsizei width, |
| 7110 GLsizei height, | 7118 GLsizei height, |
| 7111 GLint border, | 7119 GLint border, |
| 7112 GLsizei image_size, | 7120 GLsizei image_size, |
| 7113 const void* data) { | 7121 const void* data) { |
| 7114 // TODO(gman): Validate image_size is correct for width, height and format. | 7122 // TODO(gman): Validate image_size is correct for width, height and format. |
| 7115 if (!validators_->texture_target.IsValid(target)) { | 7123 if (!validators_->texture_target.IsValid(target)) { |
| 7116 SetGLError(GL_INVALID_ENUM, | 7124 SetGLErrorInvalidEnum("glCompressedTexImage2D", target, "target"); |
| 7117 "glCompressedTexImage2D", "target GL_INVALID_ENUM"); | |
| 7118 return error::kNoError; | 7125 return error::kNoError; |
| 7119 } | 7126 } |
| 7120 if (!validators_->compressed_texture_format.IsValid( | 7127 if (!validators_->compressed_texture_format.IsValid( |
| 7121 internal_format)) { | 7128 internal_format)) { |
| 7122 SetGLError(GL_INVALID_ENUM, | 7129 SetGLErrorInvalidEnum( |
| 7123 "glCompressedTexImage2D", "internal_format GL_INVALID_ENUM"); | 7130 "glCompressedTexImage2D", internal_format, "internal_format"); |
| 7124 return error::kNoError; | 7131 return error::kNoError; |
| 7125 } | 7132 } |
| 7126 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || | 7133 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || |
| 7127 border != 0) { | 7134 border != 0) { |
| 7128 SetGLError(GL_INVALID_VALUE, | 7135 SetGLError(GL_INVALID_VALUE, |
| 7129 "glCompressedTexImage2D", "dimensions out of range"); | 7136 "glCompressedTexImage2D", "dimensions out of range"); |
| 7130 return error::kNoError; | 7137 return error::kNoError; |
| 7131 } | 7138 } |
| 7132 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 7139 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
| 7133 if (!info) { | 7140 if (!info) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7252 return error::kInvalidArguments; | 7259 return error::kInvalidArguments; |
| 7253 } | 7260 } |
| 7254 uint32 data_size = bucket->size(); | 7261 uint32 data_size = bucket->size(); |
| 7255 GLsizei imageSize = data_size; | 7262 GLsizei imageSize = data_size; |
| 7256 const void* data = bucket->GetData(0, data_size); | 7263 const void* data = bucket->GetData(0, data_size); |
| 7257 if (!data) { | 7264 if (!data) { |
| 7258 return error::kInvalidArguments; | 7265 return error::kInvalidArguments; |
| 7259 } | 7266 } |
| 7260 if (!validators_->texture_target.IsValid(target)) { | 7267 if (!validators_->texture_target.IsValid(target)) { |
| 7261 SetGLError( | 7268 SetGLError( |
| 7262 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target GL_INVALID_ENUM"); | 7269 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target"); |
| 7263 return error::kNoError; | 7270 return error::kNoError; |
| 7264 } | 7271 } |
| 7265 if (!validators_->compressed_texture_format.IsValid(format)) { | 7272 if (!validators_->compressed_texture_format.IsValid(format)) { |
| 7266 SetGLError(GL_INVALID_ENUM, | 7273 SetGLErrorInvalidEnum("glCompressedTexSubImage2D", format, "format"); |
| 7267 "glCompressedTexSubImage2D", "format GL_INVALID_ENUM"); | |
| 7268 return error::kNoError; | 7274 return error::kNoError; |
| 7269 } | 7275 } |
| 7270 if (width < 0) { | 7276 if (width < 0) { |
| 7271 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D", "width < 0"); | 7277 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D", "width < 0"); |
| 7272 return error::kNoError; | 7278 return error::kNoError; |
| 7273 } | 7279 } |
| 7274 if (height < 0) { | 7280 if (height < 0) { |
| 7275 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D", "height < 0"); | 7281 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D", "height < 0"); |
| 7276 return error::kNoError; | 7282 return error::kNoError; |
| 7277 } | 7283 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7311 GLint level, | 7317 GLint level, |
| 7312 GLenum internal_format, | 7318 GLenum internal_format, |
| 7313 GLsizei width, | 7319 GLsizei width, |
| 7314 GLsizei height, | 7320 GLsizei height, |
| 7315 GLint border, | 7321 GLint border, |
| 7316 GLenum format, | 7322 GLenum format, |
| 7317 GLenum type, | 7323 GLenum type, |
| 7318 const void* pixels, | 7324 const void* pixels, |
| 7319 uint32 pixels_size) { | 7325 uint32 pixels_size) { |
| 7320 if (!validators_->texture_target.IsValid(target)) { | 7326 if (!validators_->texture_target.IsValid(target)) { |
| 7321 SetGLError(GL_INVALID_ENUM, "glTexImage2D", "target GL_INVALID_ENUM"); | 7327 SetGLErrorInvalidEnum("glTexImage2D", target, "target"); |
| 7322 return error::kNoError; | 7328 return error::kNoError; |
| 7323 } | 7329 } |
| 7324 if (!validators_->texture_format.IsValid(internal_format)) { | 7330 if (!validators_->texture_format.IsValid(internal_format)) { |
| 7325 SetGLError(GL_INVALID_ENUM, | 7331 SetGLErrorInvalidEnum("glTexImage2D", internal_format, "internal_format"); |
| 7326 "glTexImage2D", "internal_format GL_INVALID_ENUM"); | |
| 7327 return error::kNoError; | 7332 return error::kNoError; |
| 7328 } | 7333 } |
| 7329 if (!validators_->texture_format.IsValid(format)) { | 7334 if (!validators_->texture_format.IsValid(format)) { |
| 7330 SetGLError(GL_INVALID_ENUM, "glTexImage2D", "format GL_INVALID_ENUM"); | 7335 SetGLErrorInvalidEnum("glTexImage2D", format, "format"); |
| 7331 return error::kNoError; | 7336 return error::kNoError; |
| 7332 } | 7337 } |
| 7333 if (!validators_->pixel_type.IsValid(type)) { | 7338 if (!validators_->pixel_type.IsValid(type)) { |
| 7334 SetGLError(GL_INVALID_ENUM, "glTexImage2D", "type GL_INVALID_ENUM"); | 7339 SetGLErrorInvalidEnum("glTexImage2D", type, "type"); |
| 7335 return error::kNoError; | 7340 return error::kNoError; |
| 7336 } | 7341 } |
| 7337 if (format != internal_format) { | 7342 if (format != internal_format) { |
| 7338 SetGLError(GL_INVALID_OPERATION, | 7343 SetGLError(GL_INVALID_OPERATION, |
| 7339 "glTexImage2D", "format != internalFormat"); | 7344 "glTexImage2D", "format != internalFormat"); |
| 7340 return error::kNoError; | 7345 return error::kNoError; |
| 7341 } | 7346 } |
| 7342 if (!ValidateTextureParameters("glTexImage2D", target, format, type, level)) { | 7347 if (!ValidateTextureParameters("glTexImage2D", target, format, type, level)) { |
| 7343 return error::kNoError; | 7348 return error::kNoError; |
| 7344 } | 7349 } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7831 GLenum format = static_cast<GLenum>(c.format); | 7836 GLenum format = static_cast<GLenum>(c.format); |
| 7832 GLenum type = static_cast<GLenum>(c.type); | 7837 GLenum type = static_cast<GLenum>(c.type); |
| 7833 uint32 data_size; | 7838 uint32 data_size; |
| 7834 if (!GLES2Util::ComputeImageDataSizes( | 7839 if (!GLES2Util::ComputeImageDataSizes( |
| 7835 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { | 7840 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { |
| 7836 return error::kOutOfBounds; | 7841 return error::kOutOfBounds; |
| 7837 } | 7842 } |
| 7838 const void* pixels = GetSharedMemoryAs<const void*>( | 7843 const void* pixels = GetSharedMemoryAs<const void*>( |
| 7839 c.pixels_shm_id, c.pixels_shm_offset, data_size); | 7844 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
| 7840 if (!validators_->texture_target.IsValid(target)) { | 7845 if (!validators_->texture_target.IsValid(target)) { |
| 7841 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D", "target GL_INVALID_ENUM"); | 7846 SetGLErrorInvalidEnum("glTexSubImage2D", target, "target"); |
| 7842 return error::kNoError; | 7847 return error::kNoError; |
| 7843 } | 7848 } |
| 7844 if (width < 0) { | 7849 if (width < 0) { |
| 7845 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "width < 0"); | 7850 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "width < 0"); |
| 7846 return error::kNoError; | 7851 return error::kNoError; |
| 7847 } | 7852 } |
| 7848 if (height < 0) { | 7853 if (height < 0) { |
| 7849 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "height < 0"); | 7854 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "height < 0"); |
| 7850 return error::kNoError; | 7855 return error::kNoError; |
| 7851 } | 7856 } |
| 7852 if (!validators_->texture_format.IsValid(format)) { | 7857 if (!validators_->texture_format.IsValid(format)) { |
| 7853 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D", "format GL_INVALID_ENUM"); | 7858 SetGLErrorInvalidEnum("glTexSubImage2D", format, "format"); |
| 7854 return error::kNoError; | 7859 return error::kNoError; |
| 7855 } | 7860 } |
| 7856 if (!validators_->pixel_type.IsValid(type)) { | 7861 if (!validators_->pixel_type.IsValid(type)) { |
| 7857 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D", "type GL_INVALID_ENUM"); | 7862 SetGLErrorInvalidEnum("glTexSubImage2D", type, "type"); |
| 7858 return error::kNoError; | 7863 return error::kNoError; |
| 7859 } | 7864 } |
| 7860 if (pixels == NULL) { | 7865 if (pixels == NULL) { |
| 7861 return error::kOutOfBounds; | 7866 return error::kOutOfBounds; |
| 7862 } | 7867 } |
| 7863 DoTexSubImage2D( | 7868 DoTexSubImage2D( |
| 7864 target, level, xoffset, yoffset, width, height, format, type, pixels); | 7869 target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 7865 return error::kNoError; | 7870 return error::kNoError; |
| 7866 } | 7871 } |
| 7867 | 7872 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7880 GLenum format = static_cast<GLenum>(c.format); | 7885 GLenum format = static_cast<GLenum>(c.format); |
| 7881 GLenum type = static_cast<GLenum>(c.type); | 7886 GLenum type = static_cast<GLenum>(c.type); |
| 7882 uint32 data_size; | 7887 uint32 data_size; |
| 7883 if (!GLES2Util::ComputeImageDataSizes( | 7888 if (!GLES2Util::ComputeImageDataSizes( |
| 7884 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { | 7889 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { |
| 7885 return error::kOutOfBounds; | 7890 return error::kOutOfBounds; |
| 7886 } | 7891 } |
| 7887 const void* pixels = GetImmediateDataAs<const void*>( | 7892 const void* pixels = GetImmediateDataAs<const void*>( |
| 7888 c, data_size, immediate_data_size); | 7893 c, data_size, immediate_data_size); |
| 7889 if (!validators_->texture_target.IsValid(target)) { | 7894 if (!validators_->texture_target.IsValid(target)) { |
| 7890 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D", "target GL_INVALID_ENUM"); | 7895 SetGLErrorInvalidEnum("glTexSubImage2D", target, "target"); |
| 7891 return error::kNoError; | 7896 return error::kNoError; |
| 7892 } | 7897 } |
| 7893 if (width < 0) { | 7898 if (width < 0) { |
| 7894 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "width < 0"); | 7899 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "width < 0"); |
| 7895 return error::kNoError; | 7900 return error::kNoError; |
| 7896 } | 7901 } |
| 7897 if (height < 0) { | 7902 if (height < 0) { |
| 7898 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "height < 0"); | 7903 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "height < 0"); |
| 7899 return error::kNoError; | 7904 return error::kNoError; |
| 7900 } | 7905 } |
| 7901 if (!validators_->texture_format.IsValid(format)) { | 7906 if (!validators_->texture_format.IsValid(format)) { |
| 7902 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D", "format GL_INVALID_ENUM"); | 7907 SetGLErrorInvalidEnum("glTexSubImage2D", format, "format"); |
| 7903 return error::kNoError; | 7908 return error::kNoError; |
| 7904 } | 7909 } |
| 7905 if (!validators_->pixel_type.IsValid(type)) { | 7910 if (!validators_->pixel_type.IsValid(type)) { |
| 7906 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D", "type GL_INVALID_ENUM"); | 7911 SetGLErrorInvalidEnum("glTexSubImage2D", type, "type"); |
| 7907 return error::kNoError; | 7912 return error::kNoError; |
| 7908 } | 7913 } |
| 7909 if (pixels == NULL) { | 7914 if (pixels == NULL) { |
| 7910 return error::kOutOfBounds; | 7915 return error::kOutOfBounds; |
| 7911 } | 7916 } |
| 7912 DoTexSubImage2D( | 7917 DoTexSubImage2D( |
| 7913 target, level, xoffset, yoffset, width, height, format, type, pixels); | 7918 target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 7914 return error::kNoError; | 7919 return error::kNoError; |
| 7915 } | 7920 } |
| 7916 | 7921 |
| 7917 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( | 7922 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( |
| 7918 uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { | 7923 uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { |
| 7919 GLuint index = static_cast<GLuint>(c.index); | 7924 GLuint index = static_cast<GLuint>(c.index); |
| 7920 GLenum pname = static_cast<GLenum>(c.pname); | 7925 GLenum pname = static_cast<GLenum>(c.pname); |
| 7921 typedef gles2::GetVertexAttribPointerv::Result Result; | 7926 typedef gles2::GetVertexAttribPointerv::Result Result; |
| 7922 Result* result = GetSharedMemoryAs<Result*>( | 7927 Result* result = GetSharedMemoryAs<Result*>( |
| 7923 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); | 7928 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); |
| 7924 if (!result) { | 7929 if (!result) { |
| 7925 return error::kOutOfBounds; | 7930 return error::kOutOfBounds; |
| 7926 } | 7931 } |
| 7927 // Check that the client initialized the result. | 7932 // Check that the client initialized the result. |
| 7928 if (result->size != 0) { | 7933 if (result->size != 0) { |
| 7929 return error::kInvalidArguments; | 7934 return error::kInvalidArguments; |
| 7930 } | 7935 } |
| 7931 if (!validators_->vertex_pointer.IsValid(pname)) { | 7936 if (!validators_->vertex_pointer.IsValid(pname)) { |
| 7932 SetGLError(GL_INVALID_ENUM, | 7937 SetGLErrorInvalidEnum("glGetVertexAttribPointerv", pname, "pname"); |
| 7933 "glGetVertexAttribPointerv", "pname GL_INVALID_ENUM"); | |
| 7934 return error::kNoError; | 7938 return error::kNoError; |
| 7935 } | 7939 } |
| 7936 if (index >= group_->max_vertex_attribs()) { | 7940 if (index >= group_->max_vertex_attribs()) { |
| 7937 SetGLError(GL_INVALID_VALUE, | 7941 SetGLError(GL_INVALID_VALUE, |
| 7938 "glGetVertexAttribPointerv", "index out of range."); | 7942 "glGetVertexAttribPointerv", "index out of range."); |
| 7939 return error::kNoError; | 7943 return error::kNoError; |
| 7940 } | 7944 } |
| 7941 result->SetNumResults(1); | 7945 result->SetNumResults(1); |
| 7942 *result->GetData() = | 7946 *result->GetData() = |
| 7943 vertex_attrib_manager_->GetVertexAttribInfo(index)->offset(); | 7947 vertex_attrib_manager_->GetVertexAttribInfo(index)->offset(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8060 Result* result = GetSharedMemoryAs<Result*>( | 8064 Result* result = GetSharedMemoryAs<Result*>( |
| 8061 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 8065 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 8062 if (!result) { | 8066 if (!result) { |
| 8063 return error::kOutOfBounds; | 8067 return error::kOutOfBounds; |
| 8064 } | 8068 } |
| 8065 // Check that the client initialized the result. | 8069 // Check that the client initialized the result. |
| 8066 if (result->success != 0) { | 8070 if (result->success != 0) { |
| 8067 return error::kInvalidArguments; | 8071 return error::kInvalidArguments; |
| 8068 } | 8072 } |
| 8069 if (!validators_->shader_type.IsValid(shader_type)) { | 8073 if (!validators_->shader_type.IsValid(shader_type)) { |
| 8070 SetGLError(GL_INVALID_ENUM, | 8074 SetGLErrorInvalidEnum( |
| 8071 "glGetShaderPrecisionFormat", "shader_type GL_INVALID_ENUM"); | 8075 "glGetShaderPrecisionFormat", shader_type, "shader_type"); |
| 8072 return error::kNoError; | 8076 return error::kNoError; |
| 8073 } | 8077 } |
| 8074 if (!validators_->shader_precision.IsValid(precision_type)) { | 8078 if (!validators_->shader_precision.IsValid(precision_type)) { |
| 8075 SetGLError(GL_INVALID_ENUM, | 8079 SetGLErrorInvalidEnum( |
| 8076 "glGetShaderPrecisionFormat", "precision_type GL_INVALID_ENUM"); | 8080 "glGetShaderPrecisionFormat", precision_type, "precision_type"); |
| 8077 return error::kNoError; | 8081 return error::kNoError; |
| 8078 } | 8082 } |
| 8079 | 8083 |
| 8080 result->success = 1; // true | 8084 result->success = 1; // true |
| 8081 switch (precision_type) { | 8085 switch (precision_type) { |
| 8082 case GL_LOW_INT: | 8086 case GL_LOW_INT: |
| 8083 case GL_MEDIUM_INT: | 8087 case GL_MEDIUM_INT: |
| 8084 case GL_HIGH_INT: | 8088 case GL_HIGH_INT: |
| 8085 // These values are for a 32-bit twos-complement integer format. | 8089 // These values are for a 32-bit twos-complement integer format. |
| 8086 result->min_range = 31; | 8090 result->min_range = 31; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8464 // can't change them between the time we validate them and the time we use | 8468 // can't change them between the time we validate them and the time we use |
| 8465 // them. | 8469 // them. |
| 8466 scoped_array<GLenum> enums(new GLenum[count]); | 8470 scoped_array<GLenum> enums(new GLenum[count]); |
| 8467 memcpy(enums.get(), pnames, pnames_size); | 8471 memcpy(enums.get(), pnames, pnames_size); |
| 8468 | 8472 |
| 8469 // Count up the space needed for the result. | 8473 // Count up the space needed for the result. |
| 8470 uint32 num_results = 0; | 8474 uint32 num_results = 0; |
| 8471 for (GLuint ii = 0; ii < count; ++ii) { | 8475 for (GLuint ii = 0; ii < count; ++ii) { |
| 8472 uint32 num = util_.GLGetNumValuesReturned(enums[ii]); | 8476 uint32 num = util_.GLGetNumValuesReturned(enums[ii]); |
| 8473 if (num == 0) { | 8477 if (num == 0) { |
| 8474 SetGLError(GL_INVALID_ENUM, | 8478 SetGLErrorInvalidEnum("glGetMulitpleCHROMIUM", enums[ii], "pname"); |
| 8475 "glGetMulitpleCHROMIUM", "pname GL_INVALID_ENUM"); | |
| 8476 return error::kNoError; | 8479 return error::kNoError; |
| 8477 } | 8480 } |
| 8478 // Num will never be more than 4. | 8481 // Num will never be more than 4. |
| 8479 DCHECK_LE(num, 4u); | 8482 DCHECK_LE(num, 4u); |
| 8480 if (!SafeAdd(num_results, num, &num_results)) { | 8483 if (!SafeAdd(num_results, num, &num_results)) { |
| 8481 return error::kOutOfBounds; | 8484 return error::kOutOfBounds; |
| 8482 } | 8485 } |
| 8483 } | 8486 } |
| 8484 | 8487 |
| 8485 uint32 result_size = 0; | 8488 uint32 result_size = 0; |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9235 } | 9238 } |
| 9236 | 9239 |
| 9237 | 9240 |
| 9238 // Include the auto-generated part of this file. We split this because it means | 9241 // Include the auto-generated part of this file. We split this because it means |
| 9239 // we can easily edit the non-auto generated parts right here in this file | 9242 // we can easily edit the non-auto generated parts right here in this file |
| 9240 // instead of having to edit some template or the code generator. | 9243 // instead of having to edit some template or the code generator. |
| 9241 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9244 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 9242 | 9245 |
| 9243 } // namespace gles2 | 9246 } // namespace gles2 |
| 9244 } // namespace gpu | 9247 } // namespace gpu |
| OLD | NEW |