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

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: mcasas@comments 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(ClientBuffer* buffers,
4717 GLsizei width, 4717 GLsizei width,
4718 GLsizei height, 4718 GLsizei height,
4719 GLenum internalformat) { 4719 GLenum internalformat) {
4720 if (buffers == nullptr) {
reveman 2015/03/02 20:09:55 I don't think this check makes sense. We used to c
emircan 2015/03/03 02:02:18 I agree there is no way to check each of the multi
reveman 2015/03/03 05:57:09 In general, I don't think it makes sense to check
emircan 2015/03/04 03:03:15 Changed it as suggested.
4721 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid |buffers|");
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");
reveman 2015/03/02 20:09:56 | is typically used when referring to variables in
reveman 2015/03/02 20:09:56 | is typically used when referring to variables in
emircan 2015/03/03 02:02:19 Done.
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");
reveman 2015/03/02 20:09:56 ditto
emircan 2015/03/03 02:02:18 Done.
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
4740 // TODO(emircan): See http://crbug.com/439520; support passing multiple
4741 // buffers when new multi-planar formats are added.
4735 int32_t image_id = 4742 int32_t image_id =
4736 gpu_control_->CreateImage(buffer, width, height, internalformat); 4743 gpu_control_->CreateImage(buffers[0], width, height, internalformat);
reveman 2015/03/02 20:09:55 I think we should update the GpuControl interface
4737 if (image_id < 0) { 4744 if (image_id < 0) {
4738 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); 4745 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0");
4739 return 0; 4746 return 0;
4740 } 4747 }
4741 return image_id; 4748 return image_id;
4742 } 4749 }
4743 4750
4744 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, 4751 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer* buffers,
4745 GLsizei width, 4752 GLsizei width,
4746 GLsizei height, 4753 GLsizei height,
4747 GLenum internalformat) { 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