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 4695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4706 case GL_MAP_CHROMIUM: | 4706 case GL_MAP_CHROMIUM: |
4707 case GL_SCANOUT_CHROMIUM: | 4707 case GL_SCANOUT_CHROMIUM: |
4708 return true; | 4708 return true; |
4709 default: | 4709 default: |
4710 return false; | 4710 return false; |
4711 } | 4711 } |
4712 } | 4712 } |
4713 | 4713 |
4714 } // namespace | 4714 } // namespace |
4715 | 4715 |
4716 GLuint GLES2Implementation::CreateImageCHROMIUMHelper(ClientBuffer buffer, | 4716 GLuint GLES2Implementation::CreateImageCHROMIUMHelper(ClientBuffer* buffers, |
4717 GLsizei width, | 4717 GLsizei width, |
4718 GLsizei height, | 4718 GLsizei height, |
4719 GLenum internalformat) { | 4719 GLenum internalformat) { |
4720 if (buffers == nullptr) { | |
4721 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid buffers"); | |
mcasas
2015/02/28 01:14:26
nit: s/buffers/|buffers|/, although I don't see th
emircan
2015/02/28 02:33:36
Changed this and the ones below.
| |
4722 return 0; | |
4723 } | |
4724 | |
4720 if (width <= 0) { | 4725 if (width <= 0) { |
4721 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); | 4726 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); |
4722 return 0; | 4727 return 0; |
4723 } | 4728 } |
4724 | 4729 |
4725 if (height <= 0) { | 4730 if (height <= 0) { |
4726 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); | 4731 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); |
4727 return 0; | 4732 return 0; |
4728 } | 4733 } |
4729 | 4734 |
4730 if (!ValidImageFormat(internalformat)) { | 4735 if (!ValidImageFormat(internalformat)) { |
4731 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); | 4736 SetGLError(GL_INVALID_ENUM, "glCreateImageCHROMIUM", "invalid format"); |
4732 return 0; | 4737 return 0; |
4733 } | 4738 } |
4734 | 4739 |
4735 int32_t image_id = | 4740 int32_t image_id = |
4736 gpu_control_->CreateImage(buffer, width, height, internalformat); | 4741 gpu_control_->CreateImage(buffers[0], width, height, internalformat); |
mcasas
2015/02/28 01:14:26
Add a TODO() while you prepare and land the other,
emircan
2015/02/28 02:33:36
Added referencing the original bug reported.
| |
4737 if (image_id < 0) { | 4742 if (image_id < 0) { |
4738 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); | 4743 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); |
4739 return 0; | 4744 return 0; |
4740 } | 4745 } |
4741 return image_id; | 4746 return image_id; |
4742 } | 4747 } |
4743 | 4748 |
4744 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, | 4749 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer* buffers, |
4745 GLsizei width, | 4750 GLsizei width, |
4746 GLsizei height, | 4751 GLsizei height, |
4747 GLenum internalformat) { | 4752 GLenum internalformat) { |
4748 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4753 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
4749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width | 4754 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width |
4750 << ", " << height << ", " | 4755 << ", " << height << ", " |
4751 << GLES2Util::GetStringImageInternalFormat(internalformat) | 4756 << GLES2Util::GetStringImageInternalFormat(internalformat) |
4752 << ")"); | 4757 << ")"); |
4753 GLuint image_id = | 4758 GLuint image_id = |
4754 CreateImageCHROMIUMHelper(buffer, width, height, internalformat); | 4759 CreateImageCHROMIUMHelper(buffers, width, height, internalformat); |
4755 CheckGLError(); | 4760 CheckGLError(); |
4756 return image_id; | 4761 return image_id; |
4757 } | 4762 } |
4758 | 4763 |
4759 void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) { | 4764 void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) { |
4760 // Flush the command stream to make sure all pending commands | 4765 // Flush the command stream to make sure all pending commands |
4761 // that may refer to the image_id are executed on the service side. | 4766 // that may refer to the image_id are executed on the service side. |
4762 helper_->CommandBufferHelper::Flush(); | 4767 helper_->CommandBufferHelper::Flush(); |
4763 gpu_control_->DestroyImage(image_id); | 4768 gpu_control_->DestroyImage(image_id); |
4764 } | 4769 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4991 CheckGLError(); | 4996 CheckGLError(); |
4992 } | 4997 } |
4993 | 4998 |
4994 // Include the auto-generated part of this file. We split this because it means | 4999 // Include the auto-generated part of this file. We split this because it means |
4995 // we can easily edit the non-auto generated parts right here in this file | 5000 // we can easily edit the non-auto generated parts right here in this file |
4996 // instead of having to edit some template or the code generator. | 5001 // instead of having to edit some template or the code generator. |
4997 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 5002 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4998 | 5003 |
4999 } // namespace gles2 | 5004 } // namespace gles2 |
5000 } // namespace gpu | 5005 } // namespace gpu |
OLD | NEW |