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 4842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4853 if (index >= group_->max_vertex_attribs()) { | 4853 if (index >= group_->max_vertex_attribs()) { |
4854 LOCAL_SET_GL_ERROR( | 4854 LOCAL_SET_GL_ERROR( |
4855 GL_INVALID_VALUE, "glBindAttribLocation", "index out of range"); | 4855 GL_INVALID_VALUE, "glBindAttribLocation", "index out of range"); |
4856 return; | 4856 return; |
4857 } | 4857 } |
4858 Program* program = GetProgramInfoNotShader( | 4858 Program* program = GetProgramInfoNotShader( |
4859 program_id, "glBindAttribLocation"); | 4859 program_id, "glBindAttribLocation"); |
4860 if (!program) { | 4860 if (!program) { |
4861 return; | 4861 return; |
4862 } | 4862 } |
4863 // At this point, the program's shaders may not be translated yet, | |
4864 // therefore, we may not find the hashed attribute name. | |
4865 // glBindAttribLocation call with original name is useless. | |
4866 // So instead, we should simply cache the binding, and then call | |
4867 // Program::ExecuteBindAttribLocationCalls() right before link. | |
4863 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); | 4868 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); |
4869 // TODO(zmo): Get rid of the following glBindAttribLocation call. | |
Zhenyao Mo
2014/10/11 00:25:41
I didn't do this in this CL, but simply add a TODO
| |
4864 glBindAttribLocation(program->service_id(), index, name); | 4870 glBindAttribLocation(program->service_id(), index, name); |
4865 } | 4871 } |
4866 | 4872 |
4867 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( | 4873 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( |
4868 uint32 immediate_data_size, | 4874 uint32 immediate_data_size, |
4869 const void* cmd_data) { | 4875 const void* cmd_data) { |
4870 const gles2::cmds::BindAttribLocationBucket& c = | 4876 const gles2::cmds::BindAttribLocationBucket& c = |
4871 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); | 4877 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); |
4872 GLuint program = static_cast<GLuint>(c.program); | 4878 GLuint program = static_cast<GLuint>(c.program); |
4873 GLuint index = static_cast<GLuint>(c.index); | 4879 GLuint index = static_cast<GLuint>(c.index); |
(...skipping 6271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11145 } | 11151 } |
11146 } | 11152 } |
11147 | 11153 |
11148 // Include the auto-generated part of this file. We split this because it means | 11154 // Include the auto-generated part of this file. We split this because it means |
11149 // we can easily edit the non-auto generated parts right here in this file | 11155 // we can easily edit the non-auto generated parts right here in this file |
11150 // instead of having to edit some template or the code generator. | 11156 // instead of having to edit some template or the code generator. |
11151 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11157 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11152 | 11158 |
11153 } // namespace gles2 | 11159 } // namespace gles2 |
11154 } // namespace gpu | 11160 } // namespace gpu |
OLD | NEW |