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 5365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5376 BufferManager::BufferInfo* buffer_info = info->buffer(); | 5376 BufferManager::BufferInfo* buffer_info = info->buffer(); |
5377 glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); | 5377 glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); |
5378 glVertexAttribPointer( | 5378 glVertexAttribPointer( |
5379 attrib, info->size(), info->type(), info->normalized(), info->gl_stride(), | 5379 attrib, info->size(), info->type(), info->normalized(), info->gl_stride(), |
5380 ptr); | 5380 ptr); |
5381 if (info->divisor()) | 5381 if (info->divisor()) |
5382 glVertexAttribDivisorANGLE(attrib, info->divisor()); | 5382 glVertexAttribDivisorANGLE(attrib, info->divisor()); |
5383 glBindBuffer(GL_ARRAY_BUFFER, | 5383 glBindBuffer(GL_ARRAY_BUFFER, |
5384 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); | 5384 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); |
5385 | 5385 |
5386 if (info->enabled()) { | 5386 // Never touch vertex attribute 0's state (in particular, never |
5387 glEnableVertexAttribArray(attrib); | 5387 // disable it) when running on desktop GL because it will never be |
5388 } else { | 5388 // re-enabled. |
5389 glDisableVertexAttribArray(attrib); | 5389 if (attrib != 0 || |
| 5390 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { |
| 5391 if (info->enabled()) { |
| 5392 glEnableVertexAttribArray(attrib); |
| 5393 } else { |
| 5394 glDisableVertexAttribArray(attrib); |
| 5395 } |
5390 } | 5396 } |
5391 } | 5397 } |
5392 | 5398 |
5393 bool GLES2DecoderImpl::SimulateFixedAttribs( | 5399 bool GLES2DecoderImpl::SimulateFixedAttribs( |
5394 const char* function_name, | 5400 const char* function_name, |
5395 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { | 5401 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { |
5396 DCHECK(simulated); | 5402 DCHECK(simulated); |
5397 *simulated = false; | 5403 *simulated = false; |
5398 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) | 5404 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) |
5399 return true; | 5405 return true; |
(...skipping 3786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9186 BindAndApplyTextureParameters(info); | 9192 BindAndApplyTextureParameters(info); |
9187 } | 9193 } |
9188 | 9194 |
9189 // Include the auto-generated part of this file. We split this because it means | 9195 // Include the auto-generated part of this file. We split this because it means |
9190 // we can easily edit the non-auto generated parts right here in this file | 9196 // we can easily edit the non-auto generated parts right here in this file |
9191 // instead of having to edit some template or the code generator. | 9197 // instead of having to edit some template or the code generator. |
9192 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9198 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
9193 | 9199 |
9194 } // namespace gles2 | 9200 } // namespace gles2 |
9195 } // namespace gpu | 9201 } // namespace gpu |
OLD | NEW |