| 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/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 6054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6065 << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width | 6065 << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width |
| 6066 << ", " << height << ", " | 6066 << ", " << height << ", " |
| 6067 << GLES2Util::GetStringImageInternalFormat(internalformat) | 6067 << GLES2Util::GetStringImageInternalFormat(internalformat) |
| 6068 << ", " << GLES2Util::GetStringImageUsage(usage) << ")"); | 6068 << ", " << GLES2Util::GetStringImageUsage(usage) << ")"); |
| 6069 GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper( | 6069 GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper( |
| 6070 width, height, internalformat, usage); | 6070 width, height, internalformat, usage); |
| 6071 CheckGLError(); | 6071 CheckGLError(); |
| 6072 return image_id; | 6072 return image_id; |
| 6073 } | 6073 } |
| 6074 | 6074 |
| 6075 void GLES2Implementation::GetImageivCHROMIUM(GLuint image_id, |
| 6076 GLenum param, |
| 6077 GLint* data) { |
| 6078 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 6079 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetImageivCHROMIUM(" << image_id |
| 6080 << ", " << GLES2Util::GetStringImageInternalFormat(param) |
| 6081 << ")"); |
| 6082 if (param != GL_GPU_MEMORY_BUFFER_ID) { |
| 6083 SetGLError(GL_INVALID_VALUE, "GetImageivCHROMIUM", "param"); |
| 6084 *data = -1; |
| 6085 return; |
| 6086 } |
| 6087 *data = gpu_control_->GetImageGpuMemoryBufferId(image_id); |
| 6088 } |
| 6089 |
| 6075 bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { | 6090 bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { |
| 6076 if (size < 0) { | 6091 if (size < 0) { |
| 6077 SetGLError(GL_INVALID_VALUE, func, "size < 0"); | 6092 SetGLError(GL_INVALID_VALUE, func, "size < 0"); |
| 6078 return false; | 6093 return false; |
| 6079 } | 6094 } |
| 6080 if (!base::IsValueInRangeForNumericType<int32_t>(size)) { | 6095 if (!base::IsValueInRangeForNumericType<int32_t>(size)) { |
| 6081 SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit"); | 6096 SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit"); |
| 6082 return false; | 6097 return false; |
| 6083 } | 6098 } |
| 6084 return true; | 6099 return true; |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6817 cached_extensions_.clear(); | 6832 cached_extensions_.clear(); |
| 6818 } | 6833 } |
| 6819 | 6834 |
| 6820 // Include the auto-generated part of this file. We split this because it means | 6835 // Include the auto-generated part of this file. We split this because it means |
| 6821 // we can easily edit the non-auto generated parts right here in this file | 6836 // we can easily edit the non-auto generated parts right here in this file |
| 6822 // instead of having to edit some template or the code generator. | 6837 // instead of having to edit some template or the code generator. |
| 6823 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6838 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6824 | 6839 |
| 6825 } // namespace gles2 | 6840 } // namespace gles2 |
| 6826 } // namespace gpu | 6841 } // namespace gpu |
| OLD | NEW |