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 <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 3890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3901 } | 3901 } |
3902 | 3902 |
3903 gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( | 3903 gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( |
3904 image_id); | 3904 image_id); |
3905 if (!gpu_buffer) { | 3905 if (!gpu_buffer) { |
3906 SetGLError(GL_INVALID_OPERATION, "glGetImageParameterivCHROMIUM", | 3906 SetGLError(GL_INVALID_OPERATION, "glGetImageParameterivCHROMIUM", |
3907 "invalid image"); | 3907 "invalid image"); |
3908 return; | 3908 return; |
3909 } | 3909 } |
3910 | 3910 |
3911 // In Android, the SurfaceTexture based GpuMemoryBuffer can only get the | |
3912 // exact stride after it is mapped. Here it would be better to ensure that | |
3913 // it maps image first and then calls GetStride(). | |
reveman
2014/03/03 16:57:48
Same thing here. I would prefer no platform/implem
junj
2014/03/04 11:11:23
Done.
| |
3914 DCHECK(gpu_buffer->IsMapped()); | |
3911 *params = gpu_buffer->GetStride(); | 3915 *params = gpu_buffer->GetStride(); |
3912 } | 3916 } |
3913 | 3917 |
3914 void GLES2Implementation::GetImageParameterivCHROMIUM( | 3918 void GLES2Implementation::GetImageParameterivCHROMIUM( |
3915 GLuint image_id, GLenum pname, GLint* params) { | 3919 GLuint image_id, GLenum pname, GLint* params) { |
3916 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 3920 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
3917 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); | 3921 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); |
3918 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glImageParameterivCHROMIUM(" | 3922 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glImageParameterivCHROMIUM(" |
3919 << image_id << ", " | 3923 << image_id << ", " |
3920 << GLES2Util::GetStringBufferParameter(pname) << ", " | 3924 << GLES2Util::GetStringBufferParameter(pname) << ", " |
3921 << static_cast<const void*>(params) << ")"); | 3925 << static_cast<const void*>(params) << ")"); |
3922 GetImageParameterivCHROMIUMHelper(image_id, pname, params); | 3926 GetImageParameterivCHROMIUMHelper(image_id, pname, params); |
3923 CheckGLError(); | 3927 CheckGLError(); |
3924 } | 3928 } |
3925 | 3929 |
3926 // Include the auto-generated part of this file. We split this because it means | 3930 // Include the auto-generated part of this file. We split this because it means |
3927 // we can easily edit the non-auto generated parts right here in this file | 3931 // we can easily edit the non-auto generated parts right here in this file |
3928 // instead of having to edit some template or the code generator. | 3932 // instead of having to edit some template or the code generator. |
3929 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 3933 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
3930 | 3934 |
3931 } // namespace gles2 | 3935 } // namespace gles2 |
3932 } // namespace gpu | 3936 } // namespace gpu |
OLD | NEW |