Chromium Code Reviews| 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
| 10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
| (...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2307 | 2307 |
| 2308 void GLES2Implementation::GenQueriesEXTHelper( | 2308 void GLES2Implementation::GenQueriesEXTHelper( |
| 2309 GLsizei /* n */, const GLuint* /* queries */) { | 2309 GLsizei /* n */, const GLuint* /* queries */) { |
| 2310 } | 2310 } |
| 2311 | 2311 |
| 2312 void GLES2Implementation::GenValuebuffersCHROMIUMHelper( | 2312 void GLES2Implementation::GenValuebuffersCHROMIUMHelper( |
| 2313 GLsizei /* n */, | 2313 GLsizei /* n */, |
| 2314 const GLuint* /* valuebuffers */) { | 2314 const GLuint* /* valuebuffers */) { |
| 2315 } | 2315 } |
| 2316 | 2316 |
| 2317 void GLES2Implementation::GenSamplersHelper( | |
| 2318 GLsizei /* n */, const GLuint* /* samplers */) { | |
|
bajones
2014/12/10 23:13:58
Just double checking: Is this intended to be an em
Zhenyao Mo
2014/12/10 23:41:15
Yes, it's only added for the purpose of VertexArra
| |
| 2319 } | |
| 2320 | |
| 2317 // NOTE #1: On old versions of OpenGL, calling glBindXXX with an unused id | 2321 // NOTE #1: On old versions of OpenGL, calling glBindXXX with an unused id |
| 2318 // generates a new resource. On newer versions of OpenGL they don't. The code | 2322 // generates a new resource. On newer versions of OpenGL they don't. The code |
| 2319 // related to binding below will need to change if we switch to the new OpenGL | 2323 // related to binding below will need to change if we switch to the new OpenGL |
| 2320 // model. Specifically it assumes a bind will succeed which is always true in | 2324 // model. Specifically it assumes a bind will succeed which is always true in |
| 2321 // the old model but possibly not true in the new model if another context has | 2325 // the old model but possibly not true in the new model if another context has |
| 2322 // deleted the resource. | 2326 // deleted the resource. |
| 2323 | 2327 |
| 2324 void GLES2Implementation::BindBufferHelper( | 2328 void GLES2Implementation::BindBufferHelper( |
| 2325 GLenum target, GLuint buffer_id) { | 2329 GLenum target, GLuint buffer_id) { |
| 2326 // TODO(gman): See note #1 above. | 2330 // TODO(gman): See note #1 above. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2677 "id not created by this context."); | 2681 "id not created by this context."); |
| 2678 return; | 2682 return; |
| 2679 } | 2683 } |
| 2680 for (GLsizei ii = 0; ii < n; ++ii) { | 2684 for (GLsizei ii = 0; ii < n; ++ii) { |
| 2681 if (valuebuffers[ii] == bound_valuebuffer_) { | 2685 if (valuebuffers[ii] == bound_valuebuffer_) { |
| 2682 bound_valuebuffer_ = 0; | 2686 bound_valuebuffer_ = 0; |
| 2683 } | 2687 } |
| 2684 } | 2688 } |
| 2685 } | 2689 } |
| 2686 | 2690 |
| 2691 void GLES2Implementation::DeleteSamplersStub( | |
| 2692 GLsizei n, const GLuint* samplers) { | |
| 2693 helper_->DeleteSamplersImmediate(n, samplers); | |
| 2694 } | |
| 2695 | |
| 2696 void GLES2Implementation::DeleteSamplersHelper( | |
| 2697 GLsizei n, const GLuint* samplers) { | |
| 2698 if (!GetIdHandler(id_namespaces::kSamplers)->FreeIds( | |
| 2699 this, n, samplers, &GLES2Implementation::DeleteSamplersStub)) { | |
| 2700 SetGLError( | |
| 2701 GL_INVALID_VALUE, | |
| 2702 "glDeleteSamplers", "id not created by this context."); | |
| 2703 return; | |
| 2704 } | |
| 2705 } | |
| 2706 | |
| 2687 void GLES2Implementation::DeleteValuebuffersCHROMIUMStub( | 2707 void GLES2Implementation::DeleteValuebuffersCHROMIUMStub( |
| 2688 GLsizei n, | 2708 GLsizei n, |
| 2689 const GLuint* valuebuffers) { | 2709 const GLuint* valuebuffers) { |
| 2690 helper_->DeleteValuebuffersCHROMIUMImmediate(n, valuebuffers); | 2710 helper_->DeleteValuebuffersCHROMIUMImmediate(n, valuebuffers); |
| 2691 } | 2711 } |
| 2692 | 2712 |
| 2693 void GLES2Implementation::DisableVertexAttribArray(GLuint index) { | 2713 void GLES2Implementation::DisableVertexAttribArray(GLuint index) { |
| 2694 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2714 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 2695 GPU_CLIENT_LOG( | 2715 GPU_CLIENT_LOG( |
| 2696 "[" << GetLogPrefix() << "] glDisableVertexAttribArray(" << index << ")"); | 2716 "[" << GetLogPrefix() << "] glDisableVertexAttribArray(" << index << ")"); |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3978 SetGLError(GL_INVALID_VALUE, func, "offset < 0"); | 3998 SetGLError(GL_INVALID_VALUE, func, "offset < 0"); |
| 3979 return false; | 3999 return false; |
| 3980 } | 4000 } |
| 3981 if (!FitInt32NonNegative<GLintptr>(offset)) { | 4001 if (!FitInt32NonNegative<GLintptr>(offset)) { |
| 3982 SetGLError(GL_INVALID_OPERATION, func, "offset more than 32-bit"); | 4002 SetGLError(GL_INVALID_OPERATION, func, "offset more than 32-bit"); |
| 3983 return false; | 4003 return false; |
| 3984 } | 4004 } |
| 3985 return true; | 4005 return true; |
| 3986 } | 4006 } |
| 3987 | 4007 |
| 4008 bool GLES2Implementation::GetSamplerParameterfvHelper( | |
| 4009 GLuint /* sampler */, GLenum /* pname */, GLfloat* /* params */) { | |
| 4010 // TODO(zmo): Implement client side caching. | |
| 4011 return false; | |
| 4012 } | |
| 4013 | |
| 4014 bool GLES2Implementation::GetSamplerParameterivHelper( | |
| 4015 GLuint /* sampler */, GLenum /* pname */, GLint* /* params */) { | |
| 4016 // TODO(zmo): Implement client side caching. | |
| 4017 return false; | |
| 4018 } | |
| 4019 | |
| 3988 // Include the auto-generated part of this file. We split this because it means | 4020 // Include the auto-generated part of this file. We split this because it means |
| 3989 // we can easily edit the non-auto generated parts right here in this file | 4021 // we can easily edit the non-auto generated parts right here in this file |
| 3990 // instead of having to edit some template or the code generator. | 4022 // instead of having to edit some template or the code generator. |
| 3991 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4023 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 3992 | 4024 |
| 3993 } // namespace gles2 | 4025 } // namespace gles2 |
| 3994 } // namespace gpu | 4026 } // namespace gpu |
| OLD | NEW |