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 6065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6076 << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width | 6076 << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width |
6077 << ", " << height << ", " | 6077 << ", " << height << ", " |
6078 << GLES2Util::GetStringImageInternalFormat(internalformat) | 6078 << GLES2Util::GetStringImageInternalFormat(internalformat) |
6079 << ", " << GLES2Util::GetStringImageUsage(usage) << ")"); | 6079 << ", " << GLES2Util::GetStringImageUsage(usage) << ")"); |
6080 GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper( | 6080 GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper( |
6081 width, height, internalformat, usage); | 6081 width, height, internalformat, usage); |
6082 CheckGLError(); | 6082 CheckGLError(); |
6083 return image_id; | 6083 return image_id; |
6084 } | 6084 } |
6085 | 6085 |
6086 void GLES2Implementation::GetImageivCHROMIUM(GLuint image_id, | |
6087 GLenum param, | |
6088 GLint* data) { | |
6089 GPU_CLIENT_SINGLE_THREAD_CHECK(); | |
6090 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetImageivCHROMIUM(" << image_id | |
6091 << ", " << GLES2Util::GetStringImageInternalFormat(param) | |
6092 << ")"); | |
6093 if (param != GL_GPU_MEMORY_BUFFER_ID) { | |
6094 SetGLError(GL_INVALID_VALUE, "GetImageivCHROMIUM", "param"); | |
6095 *data = -1; | |
6096 return; | |
6097 } | |
6098 *data = gpu_control_->GetImageGpuMemoryBufferId(image_id); | |
6099 } | |
6100 | |
6101 bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { | 6086 bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { |
6102 if (size < 0) { | 6087 if (size < 0) { |
6103 SetGLError(GL_INVALID_VALUE, func, "size < 0"); | 6088 SetGLError(GL_INVALID_VALUE, func, "size < 0"); |
6104 return false; | 6089 return false; |
6105 } | 6090 } |
6106 if (!base::IsValueInRangeForNumericType<int32_t>(size)) { | 6091 if (!base::IsValueInRangeForNumericType<int32_t>(size)) { |
6107 SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit"); | 6092 SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit"); |
6108 return false; | 6093 return false; |
6109 } | 6094 } |
6110 return true; | 6095 return true; |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6843 cached_extensions_.clear(); | 6828 cached_extensions_.clear(); |
6844 } | 6829 } |
6845 | 6830 |
6846 // Include the auto-generated part of this file. We split this because it means | 6831 // Include the auto-generated part of this file. We split this because it means |
6847 // we can easily edit the non-auto generated parts right here in this file | 6832 // we can easily edit the non-auto generated parts right here in this file |
6848 // instead of having to edit some template or the code generator. | 6833 // instead of having to edit some template or the code generator. |
6849 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6834 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6850 | 6835 |
6851 } // namespace gles2 | 6836 } // namespace gles2 |
6852 } // namespace gpu | 6837 } // namespace gpu |
OLD | NEW |