Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 962723002: Change CHROMIUM_image declarations to support multi planar input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reveman@ comments and const-corrected function signatures. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
4717 GLsizei width, 4717 const ClientBuffer* const buffers,
4718 GLsizei height, 4718 GLsizei width,
4719 GLenum internalformat) { 4719 GLsizei height,
4720 GLenum internalformat) {
4721 if (buffers == nullptr) {
4722 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid buffers");
4723 return 0;
4724 }
4725
4720 if (width <= 0) { 4726 if (width <= 0) {
4721 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); 4727 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0");
4722 return 0; 4728 return 0;
4723 } 4729 }
4724 4730
4725 if (height <= 0) { 4731 if (height <= 0) {
4726 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); 4732 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0");
4727 return 0; 4733 return 0;
4728 } 4734 }
4729 4735
4730 if (!ValidImageFormat(internalformat)) { 4736 if (!ValidImageFormat(internalformat)) {
4731 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); 4737 SetGLError(GL_INVALID_ENUM, "glCreateImageCHROMIUM", "invalid format");
4732 return 0; 4738 return 0;
4733 } 4739 }
4734 4740
4735 int32_t image_id = 4741 int32_t image_id =
4736 gpu_control_->CreateImage(buffer, width, height, internalformat); 4742 gpu_control_->CreateImage(buffers, width, height, internalformat);
4737 if (image_id < 0) { 4743 if (image_id < 0) {
4738 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); 4744 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0");
4739 return 0; 4745 return 0;
4740 } 4746 }
4741 return image_id; 4747 return image_id;
4742 } 4748 }
4743 4749
4744 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, 4750 GLuint GLES2Implementation::CreateImageCHROMIUM(
4745 GLsizei width, 4751 const ClientBuffer* const buffers,
4746 GLsizei height, 4752 GLsizei width,
4747 GLenum internalformat) { 4753 GLsizei height,
4754 GLenum internalformat) {
4748 GPU_CLIENT_SINGLE_THREAD_CHECK(); 4755 GPU_CLIENT_SINGLE_THREAD_CHECK();
4749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width 4756 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width
4750 << ", " << height << ", " 4757 << ", " << height << ", "
4751 << GLES2Util::GetStringImageInternalFormat(internalformat) 4758 << GLES2Util::GetStringImageInternalFormat(internalformat)
4752 << ")"); 4759 << ")");
4753 GLuint image_id = 4760 GLuint image_id =
4754 CreateImageCHROMIUMHelper(buffer, width, height, internalformat); 4761 CreateImageCHROMIUMHelper(buffers, width, height, internalformat);
4755 CheckGLError(); 4762 CheckGLError();
4756 return image_id; 4763 return image_id;
4757 } 4764 }
4758 4765
4759 void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) { 4766 void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) {
4760 // Flush the command stream to make sure all pending commands 4767 // Flush the command stream to make sure all pending commands
4761 // that may refer to the image_id are executed on the service side. 4768 // that may refer to the image_id are executed on the service side.
4762 helper_->CommandBufferHelper::Flush(); 4769 helper_->CommandBufferHelper::Flush();
4763 gpu_control_->DestroyImage(image_id); 4770 gpu_control_->DestroyImage(image_id);
4764 } 4771 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 CheckGLError(); 4998 CheckGLError();
4992 } 4999 }
4993 5000
4994 // Include the auto-generated part of this file. We split this because it means 5001 // 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 5002 // 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. 5003 // instead of having to edit some template or the code generator.
4997 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 5004 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
4998 5005
4999 } // namespace gles2 5006 } // namespace gles2
5000 } // namespace gpu 5007 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698