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 */) { |
| 2319 } |
| 2320 |
| 2321 void GLES2Implementation::GenTransformFeedbacksHelper( |
| 2322 GLsizei /* n */, const GLuint* /* transformfeedbacks */) { |
| 2323 } |
| 2324 |
2317 // NOTE #1: On old versions of OpenGL, calling glBindXXX with an unused id | 2325 // 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 | 2326 // 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 | 2327 // 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 | 2328 // 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 | 2329 // the old model but possibly not true in the new model if another context has |
2322 // deleted the resource. | 2330 // deleted the resource. |
2323 | 2331 |
2324 void GLES2Implementation::BindBufferHelper( | 2332 void GLES2Implementation::BindBufferHelper( |
2325 GLenum target, GLuint buffer_id) { | 2333 GLenum target, GLuint buffer_id) { |
2326 // TODO(gman): See note #1 above. | 2334 // 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."); | 2685 "id not created by this context."); |
2678 return; | 2686 return; |
2679 } | 2687 } |
2680 for (GLsizei ii = 0; ii < n; ++ii) { | 2688 for (GLsizei ii = 0; ii < n; ++ii) { |
2681 if (valuebuffers[ii] == bound_valuebuffer_) { | 2689 if (valuebuffers[ii] == bound_valuebuffer_) { |
2682 bound_valuebuffer_ = 0; | 2690 bound_valuebuffer_ = 0; |
2683 } | 2691 } |
2684 } | 2692 } |
2685 } | 2693 } |
2686 | 2694 |
| 2695 void GLES2Implementation::DeleteSamplersStub( |
| 2696 GLsizei n, const GLuint* samplers) { |
| 2697 helper_->DeleteSamplersImmediate(n, samplers); |
| 2698 } |
| 2699 |
| 2700 void GLES2Implementation::DeleteSamplersHelper( |
| 2701 GLsizei n, const GLuint* samplers) { |
| 2702 if (!GetIdHandler(id_namespaces::kSamplers)->FreeIds( |
| 2703 this, n, samplers, &GLES2Implementation::DeleteSamplersStub)) { |
| 2704 SetGLError( |
| 2705 GL_INVALID_VALUE, |
| 2706 "glDeleteSamplers", "id not created by this context."); |
| 2707 return; |
| 2708 } |
| 2709 } |
| 2710 |
| 2711 void GLES2Implementation::DeleteTransformFeedbacksStub( |
| 2712 GLsizei n, const GLuint* transformfeedbacks) { |
| 2713 helper_->DeleteTransformFeedbacksImmediate(n, transformfeedbacks); |
| 2714 } |
| 2715 |
| 2716 void GLES2Implementation::DeleteTransformFeedbacksHelper( |
| 2717 GLsizei n, const GLuint* transformfeedbacks) { |
| 2718 if (!GetIdHandler(id_namespaces::kTransformFeedbacks)->FreeIds( |
| 2719 this, n, transformfeedbacks, |
| 2720 &GLES2Implementation::DeleteTransformFeedbacksStub)) { |
| 2721 SetGLError( |
| 2722 GL_INVALID_VALUE, |
| 2723 "glDeleteTransformFeedbacks", "id not created by this context."); |
| 2724 return; |
| 2725 } |
| 2726 } |
| 2727 |
2687 void GLES2Implementation::DeleteValuebuffersCHROMIUMStub( | 2728 void GLES2Implementation::DeleteValuebuffersCHROMIUMStub( |
2688 GLsizei n, | 2729 GLsizei n, |
2689 const GLuint* valuebuffers) { | 2730 const GLuint* valuebuffers) { |
2690 helper_->DeleteValuebuffersCHROMIUMImmediate(n, valuebuffers); | 2731 helper_->DeleteValuebuffersCHROMIUMImmediate(n, valuebuffers); |
2691 } | 2732 } |
2692 | 2733 |
2693 void GLES2Implementation::DisableVertexAttribArray(GLuint index) { | 2734 void GLES2Implementation::DisableVertexAttribArray(GLuint index) { |
2694 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2735 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2695 GPU_CLIENT_LOG( | 2736 GPU_CLIENT_LOG( |
2696 "[" << GetLogPrefix() << "] glDisableVertexAttribArray(" << index << ")"); | 2737 "[" << GetLogPrefix() << "] glDisableVertexAttribArray(" << index << ")"); |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3978 SetGLError(GL_INVALID_VALUE, func, "offset < 0"); | 4019 SetGLError(GL_INVALID_VALUE, func, "offset < 0"); |
3979 return false; | 4020 return false; |
3980 } | 4021 } |
3981 if (!FitInt32NonNegative<GLintptr>(offset)) { | 4022 if (!FitInt32NonNegative<GLintptr>(offset)) { |
3982 SetGLError(GL_INVALID_OPERATION, func, "offset more than 32-bit"); | 4023 SetGLError(GL_INVALID_OPERATION, func, "offset more than 32-bit"); |
3983 return false; | 4024 return false; |
3984 } | 4025 } |
3985 return true; | 4026 return true; |
3986 } | 4027 } |
3987 | 4028 |
| 4029 bool GLES2Implementation::GetSamplerParameterfvHelper( |
| 4030 GLuint /* sampler */, GLenum /* pname */, GLfloat* /* params */) { |
| 4031 // TODO(zmo): Implement client side caching. |
| 4032 return false; |
| 4033 } |
| 4034 |
| 4035 bool GLES2Implementation::GetSamplerParameterivHelper( |
| 4036 GLuint /* sampler */, GLenum /* pname */, GLint* /* params */) { |
| 4037 // TODO(zmo): Implement client side caching. |
| 4038 return false; |
| 4039 } |
| 4040 |
3988 // Include the auto-generated part of this file. We split this because it means | 4041 // 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 | 4042 // 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. | 4043 // instead of having to edit some template or the code generator. |
3991 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4044 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
3992 | 4045 |
3993 } // namespace gles2 | 4046 } // namespace gles2 |
3994 } // namespace gpu | 4047 } // namespace gpu |
OLD | NEW |