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 4771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4782 case GL_MAP_CHROMIUM: | 4782 case GL_MAP_CHROMIUM: |
4783 case GL_SCANOUT_CHROMIUM: | 4783 case GL_SCANOUT_CHROMIUM: |
4784 return true; | 4784 return true; |
4785 default: | 4785 default: |
4786 return false; | 4786 return false; |
4787 } | 4787 } |
4788 } | 4788 } |
4789 | 4789 |
4790 } // namespace | 4790 } // namespace |
4791 | 4791 |
4792 GLuint GLES2Implementation::CreateImageCHROMIUMHelper(ClientBuffer buffer, | 4792 GLuint GLES2Implementation::CreateImageCHROMIUMHelper( |
4793 GLsizei width, | 4793 ClientBuffer* const buffers, |
4794 GLsizei height, | 4794 GLsizei width, |
4795 GLenum internalformat) { | 4795 GLsizei height, |
| 4796 GLenum internalformat) { |
4796 if (width <= 0) { | 4797 if (width <= 0) { |
4797 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); | 4798 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); |
4798 return 0; | 4799 return 0; |
4799 } | 4800 } |
4800 | 4801 |
4801 if (height <= 0) { | 4802 if (height <= 0) { |
4802 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); | 4803 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); |
4803 return 0; | 4804 return 0; |
4804 } | 4805 } |
4805 | 4806 |
4806 if (!ValidImageFormat(internalformat)) { | 4807 if (!ValidImageFormat(internalformat)) { |
4807 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); | 4808 SetGLError(GL_INVALID_ENUM, "glCreateImageCHROMIUM", "invalid format"); |
4808 return 0; | 4809 return 0; |
4809 } | 4810 } |
4810 | 4811 |
4811 int32_t image_id = | 4812 int32_t image_id = |
4812 gpu_control_->CreateImage(buffer, width, height, internalformat); | 4813 gpu_control_->CreateImage(buffers, width, height, internalformat); |
4813 if (image_id < 0) { | 4814 if (image_id < 0) { |
4814 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); | 4815 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); |
4815 return 0; | 4816 return 0; |
4816 } | 4817 } |
4817 return image_id; | 4818 return image_id; |
4818 } | 4819 } |
4819 | 4820 |
4820 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, | 4821 GLuint GLES2Implementation::CreateImageCHROMIUM( |
4821 GLsizei width, | 4822 ClientBuffer* buffers, |
4822 GLsizei height, | 4823 GLsizei width, |
4823 GLenum internalformat) { | 4824 GLsizei height, |
| 4825 GLenum internalformat) { |
4824 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4826 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
4825 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width | 4827 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width |
4826 << ", " << height << ", " | 4828 << ", " << height << ", " |
4827 << GLES2Util::GetStringImageInternalFormat(internalformat) | 4829 << GLES2Util::GetStringImageInternalFormat(internalformat) |
4828 << ")"); | 4830 << ")"); |
4829 GLuint image_id = | 4831 GLuint image_id = |
4830 CreateImageCHROMIUMHelper(buffer, width, height, internalformat); | 4832 CreateImageCHROMIUMHelper(buffers, width, height, internalformat); |
4831 CheckGLError(); | 4833 CheckGLError(); |
4832 return image_id; | 4834 return image_id; |
4833 } | 4835 } |
4834 | 4836 |
4835 void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) { | 4837 void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) { |
4836 // Flush the command stream to make sure all pending commands | 4838 // Flush the command stream to make sure all pending commands |
4837 // that may refer to the image_id are executed on the service side. | 4839 // that may refer to the image_id are executed on the service side. |
4838 helper_->CommandBufferHelper::Flush(); | 4840 helper_->CommandBufferHelper::Flush(); |
4839 gpu_control_->DestroyImage(image_id); | 4841 gpu_control_->DestroyImage(image_id); |
4840 } | 4842 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5067 CheckGLError(); | 5069 CheckGLError(); |
5068 } | 5070 } |
5069 | 5071 |
5070 // Include the auto-generated part of this file. We split this because it means | 5072 // Include the auto-generated part of this file. We split this because it means |
5071 // we can easily edit the non-auto generated parts right here in this file | 5073 // we can easily edit the non-auto generated parts right here in this file |
5072 // instead of having to edit some template or the code generator. | 5074 // instead of having to edit some template or the code generator. |
5073 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 5075 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
5074 | 5076 |
5075 } // namespace gles2 | 5077 } // namespace gles2 |
5076 } // namespace gpu | 5078 } // namespace gpu |
OLD | NEW |