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 5201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5212 BufferManager::BufferInfo* buffer_info = info->buffer(); | 5212 BufferManager::BufferInfo* buffer_info = info->buffer(); |
5213 glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); | 5213 glBindBuffer(GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); |
5214 glVertexAttribPointer( | 5214 glVertexAttribPointer( |
5215 attrib, info->size(), info->type(), info->normalized(), info->gl_stride(), | 5215 attrib, info->size(), info->type(), info->normalized(), info->gl_stride(), |
5216 ptr); | 5216 ptr); |
5217 if (info->divisor()) | 5217 if (info->divisor()) |
5218 glVertexAttribDivisorANGLE(attrib, info->divisor()); | 5218 glVertexAttribDivisorANGLE(attrib, info->divisor()); |
5219 glBindBuffer(GL_ARRAY_BUFFER, | 5219 glBindBuffer(GL_ARRAY_BUFFER, |
5220 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); | 5220 bound_array_buffer_ ? bound_array_buffer_->service_id() : 0); |
5221 | 5221 |
5222 if (info->enabled()) { | 5222 // Never touch vertex attribute 0's state (in particular, never |
5223 glEnableVertexAttribArray(attrib); | 5223 // disable it) when running on desktop GL because it will never be |
5224 } else { | 5224 // re-enabled. |
5225 glDisableVertexAttribArray(attrib); | 5225 if (attrib != 0 || |
| 5226 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { |
| 5227 if (info->enabled()) { |
| 5228 glEnableVertexAttribArray(attrib); |
| 5229 } else { |
| 5230 glDisableVertexAttribArray(attrib); |
| 5231 } |
5226 } | 5232 } |
5227 } | 5233 } |
5228 | 5234 |
5229 bool GLES2DecoderImpl::SimulateFixedAttribs( | 5235 bool GLES2DecoderImpl::SimulateFixedAttribs( |
5230 const char* function_name, | 5236 const char* function_name, |
5231 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { | 5237 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount) { |
5232 DCHECK(simulated); | 5238 DCHECK(simulated); |
5233 *simulated = false; | 5239 *simulated = false; |
5234 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) | 5240 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) |
5235 return true; | 5241 return true; |
(...skipping 3776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9012 BindAndApplyTextureParameters(info); | 9018 BindAndApplyTextureParameters(info); |
9013 } | 9019 } |
9014 | 9020 |
9015 // Include the auto-generated part of this file. We split this because it means | 9021 // Include the auto-generated part of this file. We split this because it means |
9016 // we can easily edit the non-auto generated parts right here in this file | 9022 // we can easily edit the non-auto generated parts right here in this file |
9017 // instead of having to edit some template or the code generator. | 9023 // instead of having to edit some template or the code generator. |
9018 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9024 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
9019 | 9025 |
9020 } // namespace gles2 | 9026 } // namespace gles2 |
9021 } // namespace gpu | 9027 } // namespace gpu |
OLD | NEW |