| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    566   virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; |    566   virtual void RestoreTextureState(unsigned service_id) const OVERRIDE; | 
|    567  |    567  | 
|    568   virtual QueryManager* GetQueryManager() OVERRIDE { |    568   virtual QueryManager* GetQueryManager() OVERRIDE { | 
|    569     return query_manager_.get(); |    569     return query_manager_.get(); | 
|    570   } |    570   } | 
|    571   virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { |    571   virtual VertexArrayManager* GetVertexArrayManager() OVERRIDE { | 
|    572     return vertex_array_manager_.get(); |    572     return vertex_array_manager_.get(); | 
|    573   } |    573   } | 
|    574   virtual bool ProcessPendingQueries() OVERRIDE; |    574   virtual bool ProcessPendingQueries() OVERRIDE; | 
|    575  |    575  | 
|    576   virtual void SetGLError(GLenum error, |    576   virtual void SetGLError(unsigned error, | 
|    577                           const char* function_name, |    577                           const char* function_name, | 
|    578                           const char* msg); |    578                           const char* msg) OVERRIDE; | 
|    579   virtual void SetGLErrorInvalidEnum(const char* function_name, |    579   virtual void SetGLErrorInvalidEnum(const char* function_name, | 
|    580                                      GLenum value, |    580                                      unsigned value, | 
|    581                                      const char* label); |    581                                      const char* label) OVERRIDE; | 
|    582   virtual void SetResizeCallback( |    582   virtual void SetResizeCallback( | 
|    583       const base::Callback<void(gfx::Size)>& callback) OVERRIDE; |    583       const base::Callback<void(gfx::Size)>& callback) OVERRIDE; | 
|    584  |    584  | 
|    585   virtual void SetMsgCallback(const MsgCallback& callback) OVERRIDE; |    585   virtual void SetMsgCallback(const MsgCallback& callback) OVERRIDE; | 
|    586   virtual void SetWaitSyncPointCallback( |    586   virtual void SetWaitSyncPointCallback( | 
|    587       const WaitSyncPointCallback& callback) OVERRIDE; |    587       const WaitSyncPointCallback& callback) OVERRIDE; | 
|    588  |    588  | 
|    589   virtual void SetStreamTextureManager(StreamTextureManager* manager) OVERRIDE; |    589   virtual void SetStreamTextureManager(StreamTextureManager* manager) OVERRIDE; | 
|    590  |    590  | 
|    591   virtual gfx::AsyncPixelTransferDelegate* |    591   virtual gfx::AsyncPixelTransferDelegate* | 
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   1232   void DoGetFramebufferAttachmentParameteriv( |   1232   void DoGetFramebufferAttachmentParameteriv( | 
|   1233       GLenum target, GLenum attachment, GLenum pname, GLint* params); |   1233       GLenum target, GLenum attachment, GLenum pname, GLint* params); | 
|   1234  |   1234  | 
|   1235   // Wrapper for glGetIntegerv. |   1235   // Wrapper for glGetIntegerv. | 
|   1236   void DoGetIntegerv(GLenum pname, GLint* params); |   1236   void DoGetIntegerv(GLenum pname, GLint* params); | 
|   1237  |   1237  | 
|   1238   // Gets the max value in a range in a buffer. |   1238   // Gets the max value in a range in a buffer. | 
|   1239   GLuint DoGetMaxValueInBufferCHROMIUM( |   1239   GLuint DoGetMaxValueInBufferCHROMIUM( | 
|   1240       GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); |   1240       GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); | 
|   1241  |   1241  | 
 |   1242   // Wrapper for glGetBufferParameteriv. | 
 |   1243   void DoGetBufferParameteriv( | 
 |   1244       GLenum target, GLenum pname, GLint* params); | 
 |   1245  | 
|   1242   // Wrapper for glGetProgramiv. |   1246   // Wrapper for glGetProgramiv. | 
|   1243   void DoGetProgramiv( |   1247   void DoGetProgramiv( | 
|   1244       GLuint program_id, GLenum pname, GLint* params); |   1248       GLuint program_id, GLenum pname, GLint* params); | 
|   1245  |   1249  | 
|   1246   // Wrapper for glRenderbufferParameteriv. |   1250   // Wrapper for glRenderbufferParameteriv. | 
|   1247   void DoGetRenderbufferParameteriv( |   1251   void DoGetRenderbufferParameteriv( | 
|   1248       GLenum target, GLenum pname, GLint* params); |   1252       GLenum target, GLenum pname, GLint* params); | 
|   1249  |   1253  | 
|   1250   // Wrapper for glGetShaderiv |   1254   // Wrapper for glGetShaderiv | 
|   1251   void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params); |   1255   void DoGetShaderiv(GLuint shader, GLenum pname, GLint* params); | 
| (...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   4312 void GLES2DecoderImpl::DoGetProgramiv( |   4316 void GLES2DecoderImpl::DoGetProgramiv( | 
|   4313     GLuint program_id, GLenum pname, GLint* params) { |   4317     GLuint program_id, GLenum pname, GLint* params) { | 
|   4314   Program* info = GetProgramInfoNotShader( |   4318   Program* info = GetProgramInfoNotShader( | 
|   4315       program_id, "glGetProgramiv"); |   4319       program_id, "glGetProgramiv"); | 
|   4316   if (!info) { |   4320   if (!info) { | 
|   4317     return; |   4321     return; | 
|   4318   } |   4322   } | 
|   4319   info->GetProgramiv(pname, params); |   4323   info->GetProgramiv(pname, params); | 
|   4320 } |   4324 } | 
|   4321  |   4325  | 
 |   4326 void GLES2DecoderImpl::DoGetBufferParameteriv( | 
 |   4327     GLenum target, GLenum pname, GLint* params) { | 
 |   4328   Buffer* buffer = GetBufferInfoForTarget(target); | 
 |   4329   if (!buffer) { | 
 |   4330     return; | 
 |   4331   } | 
 |   4332   switch (pname) { | 
 |   4333     case GL_BUFFER_SIZE: | 
 |   4334       *params = buffer->size(); | 
 |   4335       break; | 
 |   4336     case GL_BUFFER_USAGE: | 
 |   4337       *params = buffer->usage(); | 
 |   4338       break; | 
 |   4339     default: | 
 |   4340       NOTREACHED(); | 
 |   4341   } | 
 |   4342 } | 
 |   4343  | 
|   4322 void GLES2DecoderImpl::DoBindAttribLocation( |   4344 void GLES2DecoderImpl::DoBindAttribLocation( | 
|   4323     GLuint program, GLuint index, const char* name) { |   4345     GLuint program, GLuint index, const char* name) { | 
|   4324   if (!StringIsValidForGLES(name)) { |   4346   if (!StringIsValidForGLES(name)) { | 
|   4325     SetGLError(GL_INVALID_VALUE, "glBindAttribLocation", "Invalid character"); |   4347     SetGLError(GL_INVALID_VALUE, "glBindAttribLocation", "Invalid character"); | 
|   4326     return; |   4348     return; | 
|   4327   } |   4349   } | 
|   4328   if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { |   4350   if (ProgramManager::IsInvalidPrefix(name, strlen(name))) { | 
|   4329     SetGLError(GL_INVALID_OPERATION, "glBindAttribLocation", "reserved prefix"); |   4351     SetGLError(GL_INVALID_OPERATION, "glBindAttribLocation", "reserved prefix"); | 
|   4330     return; |   4352     return; | 
|   4331   } |   4353   } | 
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5512  |   5534  | 
|   5513 GLenum GLES2DecoderImpl::PeekGLError() { |   5535 GLenum GLES2DecoderImpl::PeekGLError() { | 
|   5514   GLenum error = glGetError(); |   5536   GLenum error = glGetError(); | 
|   5515   if (error != GL_NO_ERROR) { |   5537   if (error != GL_NO_ERROR) { | 
|   5516     SetGLError(error, "", ""); |   5538     SetGLError(error, "", ""); | 
|   5517   } |   5539   } | 
|   5518   return error; |   5540   return error; | 
|   5519 } |   5541 } | 
|   5520  |   5542  | 
|   5521 void GLES2DecoderImpl::SetGLError( |   5543 void GLES2DecoderImpl::SetGLError( | 
|   5522     GLenum error, const char* function_name, const char* msg) { |   5544     unsigned error, const char* function_name, const char* msg) { | 
|   5523   if (msg) { |   5545   if (msg) { | 
|   5524     last_error_ = msg; |   5546     last_error_ = msg; | 
|   5525     LogMessage(GetLogPrefix() + ": " + std::string("GL ERROR :") + |   5547     LogMessage(GetLogPrefix() + ": " + std::string("GL ERROR :") + | 
|   5526                GLES2Util::GetStringEnum(error) + " : " + |   5548                GLES2Util::GetStringEnum(error) + " : " + | 
|   5527                function_name + ": " + msg); |   5549                function_name + ": " + msg); | 
|   5528   } |   5550   } | 
|   5529   error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |   5551   error_bits_ |= GLES2Util::GLErrorToErrorBit(error); | 
|   5530 } |   5552 } | 
|   5531  |   5553  | 
|   5532 void GLES2DecoderImpl::SetGLErrorInvalidEnum( |   5554 void GLES2DecoderImpl::SetGLErrorInvalidEnum( | 
|   5533     const char* function_name, GLenum value, const char* label) { |   5555     const char* function_name, unsigned value, const char* label) { | 
|   5534   SetGLError(GL_INVALID_ENUM, function_name, |   5556   SetGLError(GL_INVALID_ENUM, function_name, | 
|   5535              (std::string(label) + " was " + |   5557              (std::string(label) + " was " + | 
|   5536               GLES2Util::GetStringEnum(value)).c_str()); |   5558               GLES2Util::GetStringEnum(value)).c_str()); | 
|   5537 } |   5559 } | 
|   5538  |   5560  | 
|   5539 void GLES2DecoderImpl::SetGLErrorInvalidParam( |   5561 void GLES2DecoderImpl::SetGLErrorInvalidParam( | 
|   5540     GLenum error, |   5562     GLenum error, | 
|   5541     const char* function_name, |   5563     const char* function_name, | 
|   5542     GLenum pname, |   5564     GLenum pname, | 
|   5543     GLint param) { |   5565     GLint param) { | 
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5736   // it could never be invalid since glUseProgram would have failed. While |   5758   // it could never be invalid since glUseProgram would have failed. While | 
|   5737   // glLinkProgram could later mark the program as invalid the previous |   5759   // glLinkProgram could later mark the program as invalid the previous | 
|   5738   // valid program will still function if it is still the current program. |   5760   // valid program will still function if it is still the current program. | 
|   5739   if (!state_.current_program) { |   5761   if (!state_.current_program) { | 
|   5740     // The program does not exist. |   5762     // The program does not exist. | 
|   5741     // But GL says no ERROR. |   5763     // But GL says no ERROR. | 
|   5742     RenderWarning("Drawing with no current shader program."); |   5764     RenderWarning("Drawing with no current shader program."); | 
|   5743     return false; |   5765     return false; | 
|   5744   } |   5766   } | 
|   5745  |   5767  | 
|   5746   // true if any enabled, used divisor is zero |   5768   return state_.vertex_attrib_manager->ValidateBindings( | 
|   5747   bool divisor0 = false; |   5769       function_name, | 
|   5748   // Validate all attribs currently enabled. If they are used by the current |   5770       this, | 
|   5749   // program then check that they have enough elements to handle the draw call. |   5771       feature_info_.get(), | 
|   5750   // If they are not used by the current program check that they have a buffer |   5772       state_.current_program, | 
|   5751   // assigned. |   5773       max_vertex_accessed, | 
|   5752   const VertexAttribManager::VertexAttribInfoList& infos = |   5774       primcount); | 
|   5753       state_.vertex_attrib_manager->GetEnabledVertexAttribInfos(); |  | 
|   5754   for (VertexAttribManager::VertexAttribInfoList::const_iterator it = |  | 
|   5755        infos.begin(); it != infos.end(); ++it) { |  | 
|   5756     const VertexAttrib* info = *it; |  | 
|   5757     const Program::VertexAttrib* attrib_info = |  | 
|   5758         state_.current_program->GetAttribInfoByLocation(info->index()); |  | 
|   5759     if (attrib_info) { |  | 
|   5760       divisor0 |= (info->divisor() == 0); |  | 
|   5761       GLuint count = info->MaxVertexAccessed(primcount, max_vertex_accessed); |  | 
|   5762       // This attrib is used in the current program. |  | 
|   5763       if (!info->CanAccess(count)) { |  | 
|   5764         SetGLError( |  | 
|   5765             GL_INVALID_OPERATION, function_name, |  | 
|   5766             (std::string( |  | 
|   5767                  "attempt to access out of range vertices in attribute ") + |  | 
|   5768              base::IntToString(info->index())).c_str()); |  | 
|   5769         return false; |  | 
|   5770       } |  | 
|   5771     } else { |  | 
|   5772       // This attrib is not used in the current program. |  | 
|   5773       if (!info->buffer()) { |  | 
|   5774         SetGLError( |  | 
|   5775             GL_INVALID_OPERATION, function_name, |  | 
|   5776             (std::string( |  | 
|   5777                  "attempt to render with no buffer attached to " |  | 
|   5778                  "enabled attribute ") + |  | 
|   5779                  base::IntToString(info->index())).c_str()); |  | 
|   5780         return false; |  | 
|   5781       } |  | 
|   5782     } |  | 
|   5783   } |  | 
|   5784  |  | 
|   5785   if (primcount && !divisor0) { |  | 
|   5786     SetGLError( |  | 
|   5787         GL_INVALID_OPERATION, function_name, |  | 
|   5788         "attempt instanced render with all attributes having " |  | 
|   5789         "non-zero divisors"); |  | 
|   5790     return false; |  | 
|   5791   } |  | 
|   5792  |  | 
|   5793   return true; |  | 
|   5794 } |   5775 } | 
|   5795  |   5776  | 
|   5796 bool GLES2DecoderImpl::SimulateAttrib0( |   5777 bool GLES2DecoderImpl::SimulateAttrib0( | 
|   5797     const char* function_name, GLuint max_vertex_accessed, bool* simulated) { |   5778     const char* function_name, GLuint max_vertex_accessed, bool* simulated) { | 
|   5798   DCHECK(simulated); |   5779   DCHECK(simulated); | 
|   5799   *simulated = false; |   5780   *simulated = false; | 
|   5800  |   5781  | 
|   5801   if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) |   5782   if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) | 
|   5802     return true; |   5783     return true; | 
|   5803  |   5784  | 
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   6144  |   6125  | 
|   6145   if (!CheckBoundFramebuffersValid(function_name)) { |   6126   if (!CheckBoundFramebuffersValid(function_name)) { | 
|   6146     return error::kNoError; |   6127     return error::kNoError; | 
|   6147   } |   6128   } | 
|   6148  |   6129  | 
|   6149   if (count == 0 || (instanced && primcount == 0)) { |   6130   if (count == 0 || (instanced && primcount == 0)) { | 
|   6150     return error::kNoError; |   6131     return error::kNoError; | 
|   6151   } |   6132   } | 
|   6152  |   6133  | 
|   6153   GLuint max_vertex_accessed; |   6134   GLuint max_vertex_accessed; | 
|   6154   if (!state_.vertex_attrib_manager->element_array_buffer()-> |   6135   Buffer* element_array_buffer = | 
|   6155       GetMaxValueForRange(offset, count, type, &max_vertex_accessed)) { |   6136       state_.vertex_attrib_manager->element_array_buffer(); | 
 |   6137  | 
 |   6138   if (!element_array_buffer->GetMaxValueForRange( | 
 |   6139       offset, count, type, &max_vertex_accessed)) { | 
|   6156     SetGLError(GL_INVALID_OPERATION, |   6140     SetGLError(GL_INVALID_OPERATION, | 
|   6157                function_name, "range out of bounds for buffer"); |   6141                function_name, "range out of bounds for buffer"); | 
|   6158     return error::kNoError; |   6142     return error::kNoError; | 
|   6159   } |   6143   } | 
|   6160  |   6144  | 
|   6161   if (IsDrawValid(function_name, max_vertex_accessed, primcount)) { |   6145   if (IsDrawValid(function_name, max_vertex_accessed, primcount)) { | 
|   6162     if (!ClearUnclearedTextures()) { |   6146     if (!ClearUnclearedTextures()) { | 
|   6163       SetGLError(GL_INVALID_VALUE, function_name, "out of memory"); |   6147       SetGLError(GL_INVALID_VALUE, function_name, "out of memory"); | 
|   6164       return error::kNoError; |   6148       return error::kNoError; | 
|   6165     } |   6149     } | 
|   6166     bool simulated_attrib_0 = false; |   6150     bool simulated_attrib_0 = false; | 
|   6167     if (!SimulateAttrib0( |   6151     if (!SimulateAttrib0( | 
|   6168         function_name, max_vertex_accessed, &simulated_attrib_0)) { |   6152         function_name, max_vertex_accessed, &simulated_attrib_0)) { | 
|   6169       return error::kNoError; |   6153       return error::kNoError; | 
|   6170     } |   6154     } | 
|   6171     bool simulated_fixed_attribs = false; |   6155     bool simulated_fixed_attribs = false; | 
|   6172     if (SimulateFixedAttribs( |   6156     if (SimulateFixedAttribs( | 
|   6173         function_name, max_vertex_accessed, &simulated_fixed_attribs, |   6157         function_name, max_vertex_accessed, &simulated_fixed_attribs, | 
|   6174         primcount)) { |   6158         primcount)) { | 
|   6175       bool textures_set = SetBlackTextureForNonRenderableTextures(); |   6159       bool textures_set = SetBlackTextureForNonRenderableTextures(); | 
|   6176       ApplyDirtyState(); |   6160       ApplyDirtyState(); | 
 |   6161       // REFACTOR BEFORE CHECK IN | 
|   6177       const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); |   6162       const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); | 
 |   6163       bool used_client_side_array = false; | 
 |   6164       if (workarounds().use_client_side_arrays_for_stream_buffers) { | 
 |   6165         if (element_array_buffer->usage() == GL_STREAM_DRAW) { | 
 |   6166           used_client_side_array = true; | 
 |   6167           glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | 
 |   6168           indices = element_array_buffer->GetRange(offset, 0); | 
 |   6169         } | 
 |   6170       } | 
 |   6171  | 
|   6178       if (!instanced) { |   6172       if (!instanced) { | 
|   6179         glDrawElements(mode, count, type, indices); |   6173         glDrawElements(mode, count, type, indices); | 
|   6180       } else { |   6174       } else { | 
|   6181         glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); |   6175         glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); | 
|   6182       } |   6176       } | 
 |   6177  | 
 |   6178       if (used_client_side_array) { | 
 |   6179         glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, | 
 |   6180                      element_array_buffer->service_id()); | 
 |   6181       } | 
 |   6182  | 
|   6183       ProcessPendingQueries(); |   6183       ProcessPendingQueries(); | 
|   6184       if (textures_set) { |   6184       if (textures_set) { | 
|   6185         RestoreStateForNonRenderableTextures(); |   6185         RestoreStateForNonRenderableTextures(); | 
|   6186       } |   6186       } | 
|   6187       if (simulated_fixed_attribs) { |   6187       if (simulated_fixed_attribs) { | 
|   6188         RestoreStateForSimulatedFixedAttribs(); |   6188         RestoreStateForSimulatedFixedAttribs(); | 
|   6189       } |   6189       } | 
|   6190     } |   6190     } | 
|   6191     if (simulated_attrib_0) { |   6191     if (simulated_attrib_0) { | 
|   6192       RestoreStateForAttrib(0); |   6192       RestoreStateForAttrib(0); | 
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   7209   } |   7209   } | 
|   7210  |   7210  | 
|   7211   // Clear the buffer to 0 if no initial data was passed in. |   7211   // Clear the buffer to 0 if no initial data was passed in. | 
|   7212   scoped_array<int8> zero; |   7212   scoped_array<int8> zero; | 
|   7213   if (!data) { |   7213   if (!data) { | 
|   7214     zero.reset(new int8[size]); |   7214     zero.reset(new int8[size]); | 
|   7215     memset(zero.get(), 0, size); |   7215     memset(zero.get(), 0, size); | 
|   7216     data = zero.get(); |   7216     data = zero.get(); | 
|   7217   } |   7217   } | 
|   7218  |   7218  | 
 |   7219   // TODO(gman): move to buffer manager BEFORE CHECK IN! | 
|   7219   CopyRealGLErrorsToWrapper(); |   7220   CopyRealGLErrorsToWrapper(); | 
|   7220   glBufferData(target, size, data, usage); |   7221   if (workarounds().use_client_side_arrays_for_stream_buffers && | 
 |   7222       usage == GL_STREAM_DRAW) { | 
 |   7223     glBufferData(target, 0, NULL, GL_STREAM_DRAW); | 
 |   7224   } else { | 
 |   7225     glBufferData(target, size, data, usage); | 
 |   7226   } | 
|   7221   GLenum error = PeekGLError(); |   7227   GLenum error = PeekGLError(); | 
|   7222   if (error == GL_NO_ERROR) { |   7228   if (error == GL_NO_ERROR) { | 
|   7223     buffer_manager()->SetInfo(info, size, usage); |   7229     buffer_manager()->SetInfo(info, size, usage, data); | 
|   7224     info->SetRange(0, size, data); |  | 
|   7225   } else { |   7230   } else { | 
|   7226     buffer_manager()->SetInfo(info, 0, usage); |   7231     buffer_manager()->SetInfo(info, 0, usage, NULL); | 
|   7227   } |   7232   } | 
|   7228 } |   7233 } | 
|   7229  |   7234  | 
|   7230 error::Error GLES2DecoderImpl::HandleBufferData( |   7235 error::Error GLES2DecoderImpl::HandleBufferData( | 
|   7231     uint32 immediate_data_size, const cmds::BufferData& c) { |   7236     uint32 immediate_data_size, const cmds::BufferData& c) { | 
|   7232   GLenum target = static_cast<GLenum>(c.target); |   7237   GLenum target = static_cast<GLenum>(c.target); | 
|   7233   GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |   7238   GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 
|   7234   uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); |   7239   uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 
|   7235   uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); |   7240   uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 
|   7236   GLenum usage = static_cast<GLenum>(c.usage); |   7241   GLenum usage = static_cast<GLenum>(c.usage); | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   7254   if (!data) { |   7259   if (!data) { | 
|   7255     return error::kOutOfBounds; |   7260     return error::kOutOfBounds; | 
|   7256   } |   7261   } | 
|   7257   GLenum usage = static_cast<GLenum>(c.usage); |   7262   GLenum usage = static_cast<GLenum>(c.usage); | 
|   7258   DoBufferData(target, size, data, usage); |   7263   DoBufferData(target, size, data, usage); | 
|   7259   return error::kNoError; |   7264   return error::kNoError; | 
|   7260 } |   7265 } | 
|   7261  |   7266  | 
|   7262 void GLES2DecoderImpl::DoBufferSubData( |   7267 void GLES2DecoderImpl::DoBufferSubData( | 
|   7263   GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { |   7268   GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { | 
|   7264   Buffer* info = GetBufferInfoForTarget(target); |   7269   Buffer* buffer = GetBufferInfoForTarget(target); | 
|   7265   if (!info) { |   7270   if (!buffer) { | 
|   7266     SetGLError(GL_INVALID_VALUE, "glBufferSubData", "unknown buffer"); |   7271     SetGLError(GL_INVALID_VALUE, "glBufferSubData", "unknown buffer"); | 
|   7267     return; |   7272     return; | 
|   7268   } |   7273   } | 
|   7269   if (!info->SetRange(offset, size, data)) { |   7274   if (!buffer->SetRange(offset, size, data)) { | 
|   7270     SetGLError(GL_INVALID_VALUE, "glBufferSubData", "out of range"); |   7275     SetGLError(GL_INVALID_VALUE, "glBufferSubData", "out of range"); | 
|   7271     return; |   7276     return; | 
|   7272   } |   7277   } | 
|   7273   glBufferSubData(target, offset, size, data); |   7278  | 
 |   7279   // TODO(gman): move to buffer manager BEFORE CHECKIN! | 
 |   7280   if (!(workarounds().use_client_side_arrays_for_stream_buffers && | 
 |   7281         buffer->usage() == GL_STREAM_DRAW)) { | 
 |   7282     glBufferSubData(target, offset, size, data); | 
 |   7283   } | 
|   7274 } |   7284 } | 
|   7275  |   7285  | 
|   7276 bool GLES2DecoderImpl::ClearLevel( |   7286 bool GLES2DecoderImpl::ClearLevel( | 
|   7277     unsigned service_id, |   7287     unsigned service_id, | 
|   7278     unsigned bind_target, |   7288     unsigned bind_target, | 
|   7279     unsigned target, |   7289     unsigned target, | 
|   7280     int level, |   7290     int level, | 
|   7281     unsigned format, |   7291     unsigned format, | 
|   7282     unsigned type, |   7292     unsigned type, | 
|   7283     int width, |   7293     int width, | 
| (...skipping 2873 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  10157   return error::kNoError; |  10167   return error::kNoError; | 
|  10158 } |  10168 } | 
|  10159  |  10169  | 
|  10160 // Include the auto-generated part of this file. We split this because it means |  10170 // Include the auto-generated part of this file. We split this because it means | 
|  10161 // we can easily edit the non-auto generated parts right here in this file |  10171 // we can easily edit the non-auto generated parts right here in this file | 
|  10162 // instead of having to edit some template or the code generator. |  10172 // instead of having to edit some template or the code generator. | 
|  10163 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |  10173 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 
|  10164  |  10174  | 
|  10165 }  // namespace gles2 |  10175 }  // namespace gles2 | 
|  10166 }  // namespace gpu |  10176 }  // namespace gpu | 
| OLD | NEW |