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/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
(...skipping 3857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3868 | 3868 |
3869 void GLES2Implementation::GetVertexAttribfv( | 3869 void GLES2Implementation::GetVertexAttribfv( |
3870 GLuint index, GLenum pname, GLfloat* params) { | 3870 GLuint index, GLenum pname, GLfloat* params) { |
3871 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 3871 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
3872 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribfv(" | 3872 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribfv(" |
3873 << index << ", " | 3873 << index << ", " |
3874 << GLES2Util::GetStringVertexAttribute(pname) << ", " | 3874 << GLES2Util::GetStringVertexAttribute(pname) << ", " |
3875 << static_cast<const void*>(params) << ")"); | 3875 << static_cast<const void*>(params) << ")"); |
3876 uint32 value = 0; | 3876 uint32 value = 0; |
3877 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { | 3877 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { |
3878 *params = static_cast<float>(value); | 3878 *params = static_cast<GLfloat>(value); |
3879 return; | 3879 return; |
3880 } | 3880 } |
3881 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv"); | 3881 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv"); |
3882 typedef cmds::GetVertexAttribfv::Result Result; | 3882 typedef cmds::GetVertexAttribfv::Result Result; |
3883 Result* result = GetResultAs<Result*>(); | 3883 Result* result = GetResultAs<Result*>(); |
3884 if (!result) { | 3884 if (!result) { |
3885 return; | 3885 return; |
3886 } | 3886 } |
3887 result->SetNumResults(0); | 3887 result->SetNumResults(0); |
3888 helper_->GetVertexAttribfv( | 3888 helper_->GetVertexAttribfv( |
(...skipping 10 matching lines...) Expand all Loading... |
3899 | 3899 |
3900 void GLES2Implementation::GetVertexAttribiv( | 3900 void GLES2Implementation::GetVertexAttribiv( |
3901 GLuint index, GLenum pname, GLint* params) { | 3901 GLuint index, GLenum pname, GLint* params) { |
3902 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 3902 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
3903 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribiv(" | 3903 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribiv(" |
3904 << index << ", " | 3904 << index << ", " |
3905 << GLES2Util::GetStringVertexAttribute(pname) << ", " | 3905 << GLES2Util::GetStringVertexAttribute(pname) << ", " |
3906 << static_cast<const void*>(params) << ")"); | 3906 << static_cast<const void*>(params) << ")"); |
3907 uint32 value = 0; | 3907 uint32 value = 0; |
3908 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { | 3908 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { |
3909 *params = value; | 3909 *params = static_cast<GLint>(value); |
3910 return; | 3910 return; |
3911 } | 3911 } |
3912 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv"); | 3912 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv"); |
3913 typedef cmds::GetVertexAttribiv::Result Result; | 3913 typedef cmds::GetVertexAttribiv::Result Result; |
3914 Result* result = GetResultAs<Result*>(); | 3914 Result* result = GetResultAs<Result*>(); |
3915 if (!result) { | 3915 if (!result) { |
3916 return; | 3916 return; |
3917 } | 3917 } |
3918 result->SetNumResults(0); | 3918 result->SetNumResults(0); |
3919 helper_->GetVertexAttribiv( | 3919 helper_->GetVertexAttribiv( |
3920 index, pname, GetResultShmId(), GetResultShmOffset()); | 3920 index, pname, GetResultShmId(), GetResultShmOffset()); |
3921 WaitForCmd(); | 3921 WaitForCmd(); |
3922 result->CopyResult(params); | 3922 result->CopyResult(params); |
3923 GPU_CLIENT_LOG_CODE_BLOCK({ | 3923 GPU_CLIENT_LOG_CODE_BLOCK({ |
3924 for (int32 i = 0; i < result->GetNumResults(); ++i) { | 3924 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
3925 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); | 3925 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
3926 } | 3926 } |
3927 }); | 3927 }); |
3928 CheckGLError(); | 3928 CheckGLError(); |
3929 } | 3929 } |
3930 | 3930 |
| 3931 void GLES2Implementation::GetVertexAttribIiv( |
| 3932 GLuint index, GLenum pname, GLint* params) { |
| 3933 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 3934 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribIiv(" |
| 3935 << index << ", " |
| 3936 << GLES2Util::GetStringVertexAttribute(pname) << ", " |
| 3937 << static_cast<const void*>(params) << ")"); |
| 3938 uint32 value = 0; |
| 3939 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { |
| 3940 *params = static_cast<GLint>(value); |
| 3941 return; |
| 3942 } |
| 3943 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribIiv"); |
| 3944 typedef cmds::GetVertexAttribiv::Result Result; |
| 3945 Result* result = GetResultAs<Result*>(); |
| 3946 if (!result) { |
| 3947 return; |
| 3948 } |
| 3949 result->SetNumResults(0); |
| 3950 helper_->GetVertexAttribIiv( |
| 3951 index, pname, GetResultShmId(), GetResultShmOffset()); |
| 3952 WaitForCmd(); |
| 3953 result->CopyResult(params); |
| 3954 GPU_CLIENT_LOG_CODE_BLOCK({ |
| 3955 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
| 3956 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
| 3957 } |
| 3958 }); |
| 3959 CheckGLError(); |
| 3960 } |
| 3961 |
| 3962 void GLES2Implementation::GetVertexAttribIuiv( |
| 3963 GLuint index, GLenum pname, GLuint* params) { |
| 3964 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 3965 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribIuiv(" |
| 3966 << index << ", " |
| 3967 << GLES2Util::GetStringVertexAttribute(pname) << ", " |
| 3968 << static_cast<const void*>(params) << ")"); |
| 3969 uint32 value = 0; |
| 3970 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { |
| 3971 *params = static_cast<GLuint>(value); |
| 3972 return; |
| 3973 } |
| 3974 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribIuiv"); |
| 3975 typedef cmds::GetVertexAttribiv::Result Result; |
| 3976 Result* result = GetResultAs<Result*>(); |
| 3977 if (!result) { |
| 3978 return; |
| 3979 } |
| 3980 result->SetNumResults(0); |
| 3981 helper_->GetVertexAttribIuiv( |
| 3982 index, pname, GetResultShmId(), GetResultShmOffset()); |
| 3983 WaitForCmd(); |
| 3984 result->CopyResult(params); |
| 3985 GPU_CLIENT_LOG_CODE_BLOCK({ |
| 3986 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
| 3987 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
| 3988 } |
| 3989 }); |
| 3990 CheckGLError(); |
| 3991 } |
| 3992 |
3931 void GLES2Implementation::Swap() { | 3993 void GLES2Implementation::Swap() { |
3932 SwapBuffers(); | 3994 SwapBuffers(); |
3933 } | 3995 } |
3934 | 3996 |
3935 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { | 3997 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { |
3936 PostSubBufferCHROMIUM( | 3998 PostSubBufferCHROMIUM( |
3937 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); | 3999 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); |
3938 } | 4000 } |
3939 | 4001 |
3940 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { | 4002 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5500 CheckGLError(); | 5562 CheckGLError(); |
5501 } | 5563 } |
5502 | 5564 |
5503 // Include the auto-generated part of this file. We split this because it means | 5565 // Include the auto-generated part of this file. We split this because it means |
5504 // we can easily edit the non-auto generated parts right here in this file | 5566 // we can easily edit the non-auto generated parts right here in this file |
5505 // instead of having to edit some template or the code generator. | 5567 // instead of having to edit some template or the code generator. |
5506 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 5568 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
5507 | 5569 |
5508 } // namespace gles2 | 5570 } // namespace gles2 |
5509 } // namespace gpu | 5571 } // namespace gpu |
OLD | NEW |