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 "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 break; | 330 break; |
331 } | 331 } |
332 } | 332 } |
333 error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error); | 333 error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error); |
334 return error; | 334 return error; |
335 } | 335 } |
336 | 336 |
337 GLenum GLES2Implementation::GetGLError() { | 337 GLenum GLES2Implementation::GetGLError() { |
338 TRACE_EVENT0("gpu", "GLES2::GetGLError"); | 338 TRACE_EVENT0("gpu", "GLES2::GetGLError"); |
339 // Check the GL error first, then our wrapped error. | 339 // Check the GL error first, then our wrapped error. |
340 typedef gles2::GetError::Result Result; | 340 typedef cmds::GetError::Result Result; |
341 Result* result = GetResultAs<Result*>(); | 341 Result* result = GetResultAs<Result*>(); |
342 // If we couldn't allocate a result the context is lost. | 342 // If we couldn't allocate a result the context is lost. |
343 if (!result) { | 343 if (!result) { |
344 return GL_NO_ERROR; | 344 return GL_NO_ERROR; |
345 } | 345 } |
346 *result = GL_NO_ERROR; | 346 *result = GL_NO_ERROR; |
347 helper_->GetError(GetResultShmId(), GetResultShmOffset()); | 347 helper_->GetError(GetResultShmId(), GetResultShmOffset()); |
348 WaitForCmd(); | 348 WaitForCmd(); |
349 GLenum error = *result; | 349 GLenum error = *result; |
350 if (error == GL_NO_ERROR) { | 350 if (error == GL_NO_ERROR) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 515 } |
516 CheckGLError(); | 516 CheckGLError(); |
517 } | 517 } |
518 | 518 |
519 GLboolean GLES2Implementation::IsEnabled(GLenum cap) { | 519 GLboolean GLES2Implementation::IsEnabled(GLenum cap) { |
520 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 520 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
521 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsEnabled(" | 521 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsEnabled(" |
522 << GLES2Util::GetStringCapability(cap) << ")"); | 522 << GLES2Util::GetStringCapability(cap) << ")"); |
523 bool state = false; | 523 bool state = false; |
524 if (!state_.GetEnabled(cap, &state)) { | 524 if (!state_.GetEnabled(cap, &state)) { |
525 typedef IsEnabled::Result Result; | 525 typedef cmds::IsEnabled::Result Result; |
526 Result* result = GetResultAs<Result*>(); | 526 Result* result = GetResultAs<Result*>(); |
527 if (!result) { | 527 if (!result) { |
528 return GL_FALSE; | 528 return GL_FALSE; |
529 } | 529 } |
530 *result = 0; | 530 *result = 0; |
531 helper_->IsEnabled(cap, GetResultShmId(), GetResultShmOffset()); | 531 helper_->IsEnabled(cap, GetResultShmId(), GetResultShmOffset()); |
532 WaitForCmd(); | 532 WaitForCmd(); |
533 state = (*result) != 0; | 533 state = (*result) != 0; |
534 } | 534 } |
535 | 535 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 *params = static_cast<GLfloat>(value); | 650 *params = static_cast<GLfloat>(value); |
651 return true; | 651 return true; |
652 } | 652 } |
653 | 653 |
654 bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { | 654 bool GLES2Implementation::GetIntegervHelper(GLenum pname, GLint* params) { |
655 return GetHelper(pname, params); | 655 return GetHelper(pname, params); |
656 } | 656 } |
657 | 657 |
658 GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUMHelper( | 658 GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUMHelper( |
659 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { | 659 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { |
660 typedef GetMaxValueInBufferCHROMIUM::Result Result; | 660 typedef cmds::GetMaxValueInBufferCHROMIUM::Result Result; |
661 Result* result = GetResultAs<Result*>(); | 661 Result* result = GetResultAs<Result*>(); |
662 if (!result) { | 662 if (!result) { |
663 return 0; | 663 return 0; |
664 } | 664 } |
665 *result = 0; | 665 *result = 0; |
666 helper_->GetMaxValueInBufferCHROMIUM( | 666 helper_->GetMaxValueInBufferCHROMIUM( |
667 buffer_id, count, type, offset, GetResultShmId(), GetResultShmOffset()); | 667 buffer_id, count, type, offset, GetResultShmId(), GetResultShmOffset()); |
668 WaitForCmd(); | 668 WaitForCmd(); |
669 return *result; | 669 return *result; |
670 } | 670 } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 898 |
899 void GLES2Implementation::GetVertexAttribPointerv( | 899 void GLES2Implementation::GetVertexAttribPointerv( |
900 GLuint index, GLenum pname, void** ptr) { | 900 GLuint index, GLenum pname, void** ptr) { |
901 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 901 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
902 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribPointer(" | 902 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribPointer(" |
903 << index << ", " << GLES2Util::GetStringVertexPointer(pname) << ", " | 903 << index << ", " << GLES2Util::GetStringVertexPointer(pname) << ", " |
904 << static_cast<void*>(ptr) << ")"); | 904 << static_cast<void*>(ptr) << ")"); |
905 GPU_CLIENT_LOG_CODE_BLOCK(int32 num_results = 1); | 905 GPU_CLIENT_LOG_CODE_BLOCK(int32 num_results = 1); |
906 if (!vertex_array_object_manager_->GetAttribPointer(index, pname, ptr)) { | 906 if (!vertex_array_object_manager_->GetAttribPointer(index, pname, ptr)) { |
907 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv"); | 907 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv"); |
908 typedef gles2::GetVertexAttribPointerv::Result Result; | 908 typedef cmds::GetVertexAttribPointerv::Result Result; |
909 Result* result = GetResultAs<Result*>(); | 909 Result* result = GetResultAs<Result*>(); |
910 if (!result) { | 910 if (!result) { |
911 return; | 911 return; |
912 } | 912 } |
913 result->SetNumResults(0); | 913 result->SetNumResults(0); |
914 helper_->GetVertexAttribPointerv( | 914 helper_->GetVertexAttribPointerv( |
915 index, pname, GetResultShmId(), GetResultShmOffset()); | 915 index, pname, GetResultShmId(), GetResultShmOffset()); |
916 WaitForCmd(); | 916 WaitForCmd(); |
917 result->CopyResult(ptr); | 917 result->CopyResult(ptr); |
918 GPU_CLIENT_LOG_CODE_BLOCK(num_results = result->GetNumResults()); | 918 GPU_CLIENT_LOG_CODE_BLOCK(num_results = result->GetNumResults()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 void GLES2Implementation::DeleteShaderStub( | 960 void GLES2Implementation::DeleteShaderStub( |
961 GLsizei n, const GLuint* shaders) { | 961 GLsizei n, const GLuint* shaders) { |
962 GPU_DCHECK_EQ(1, n); | 962 GPU_DCHECK_EQ(1, n); |
963 share_group_->program_info_manager()->DeleteInfo(shaders[0]); | 963 share_group_->program_info_manager()->DeleteInfo(shaders[0]); |
964 helper_->DeleteShader(shaders[0]); | 964 helper_->DeleteShader(shaders[0]); |
965 } | 965 } |
966 | 966 |
967 | 967 |
968 GLint GLES2Implementation::GetAttribLocationHelper( | 968 GLint GLES2Implementation::GetAttribLocationHelper( |
969 GLuint program, const char* name) { | 969 GLuint program, const char* name) { |
970 typedef GetAttribLocationBucket::Result Result; | 970 typedef cmds::GetAttribLocationBucket::Result Result; |
971 Result* result = GetResultAs<Result*>(); | 971 Result* result = GetResultAs<Result*>(); |
972 if (!result) { | 972 if (!result) { |
973 return -1; | 973 return -1; |
974 } | 974 } |
975 *result = -1; | 975 *result = -1; |
976 SetBucketAsCString(kResultBucketId, name); | 976 SetBucketAsCString(kResultBucketId, name); |
977 helper_->GetAttribLocationBucket( | 977 helper_->GetAttribLocationBucket( |
978 program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); | 978 program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); |
979 WaitForCmd(); | 979 WaitForCmd(); |
980 helper_->SetBucketSize(kResultBucketId, 0); | 980 helper_->SetBucketSize(kResultBucketId, 0); |
981 return *result; | 981 return *result; |
982 } | 982 } |
983 | 983 |
984 GLint GLES2Implementation::GetAttribLocation( | 984 GLint GLES2Implementation::GetAttribLocation( |
985 GLuint program, const char* name) { | 985 GLuint program, const char* name) { |
986 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 986 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
987 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttribLocation(" << program | 987 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttribLocation(" << program |
988 << ", " << name << ")"); | 988 << ", " << name << ")"); |
989 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); | 989 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); |
990 GLint loc = share_group_->program_info_manager()->GetAttribLocation( | 990 GLint loc = share_group_->program_info_manager()->GetAttribLocation( |
991 this, program, name); | 991 this, program, name); |
992 GPU_CLIENT_LOG("returned " << loc); | 992 GPU_CLIENT_LOG("returned " << loc); |
993 CheckGLError(); | 993 CheckGLError(); |
994 return loc; | 994 return loc; |
995 } | 995 } |
996 | 996 |
997 GLint GLES2Implementation::GetUniformLocationHelper( | 997 GLint GLES2Implementation::GetUniformLocationHelper( |
998 GLuint program, const char* name) { | 998 GLuint program, const char* name) { |
999 typedef GetUniformLocationBucket::Result Result; | 999 typedef cmds::GetUniformLocationBucket::Result Result; |
1000 Result* result = GetResultAs<Result*>(); | 1000 Result* result = GetResultAs<Result*>(); |
1001 if (!result) { | 1001 if (!result) { |
1002 return -1; | 1002 return -1; |
1003 } | 1003 } |
1004 *result = -1; | 1004 *result = -1; |
1005 SetBucketAsCString(kResultBucketId, name); | 1005 SetBucketAsCString(kResultBucketId, name); |
1006 helper_->GetUniformLocationBucket(program, kResultBucketId, | 1006 helper_->GetUniformLocationBucket(program, kResultBucketId, |
1007 GetResultShmId(), GetResultShmOffset()); | 1007 GetResultShmId(), GetResultShmOffset()); |
1008 WaitForCmd(); | 1008 WaitForCmd(); |
1009 helper_->SetBucketSize(kResultBucketId, 0); | 1009 helper_->SetBucketSize(kResultBucketId, 0); |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 source += num_rows * pixels_padded_row_size; | 1744 source += num_rows * pixels_padded_row_size; |
1745 height -= num_rows; | 1745 height -= num_rows; |
1746 } | 1746 } |
1747 } | 1747 } |
1748 | 1748 |
1749 bool GLES2Implementation::GetActiveAttribHelper( | 1749 bool GLES2Implementation::GetActiveAttribHelper( |
1750 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, | 1750 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, |
1751 GLenum* type, char* name) { | 1751 GLenum* type, char* name) { |
1752 // Clear the bucket so if the command fails nothing will be in it. | 1752 // Clear the bucket so if the command fails nothing will be in it. |
1753 helper_->SetBucketSize(kResultBucketId, 0); | 1753 helper_->SetBucketSize(kResultBucketId, 0); |
1754 typedef gles2::GetActiveAttrib::Result Result; | 1754 typedef cmds::GetActiveAttrib::Result Result; |
1755 Result* result = GetResultAs<Result*>(); | 1755 Result* result = GetResultAs<Result*>(); |
1756 if (!result) { | 1756 if (!result) { |
1757 return false; | 1757 return false; |
1758 } | 1758 } |
1759 // Set as failed so if the command fails we'll recover. | 1759 // Set as failed so if the command fails we'll recover. |
1760 result->success = false; | 1760 result->success = false; |
1761 helper_->GetActiveAttrib(program, index, kResultBucketId, | 1761 helper_->GetActiveAttrib(program, index, kResultBucketId, |
1762 GetResultShmId(), GetResultShmOffset()); | 1762 GetResultShmId(), GetResultShmOffset()); |
1763 WaitForCmd(); | 1763 WaitForCmd(); |
1764 if (result->success) { | 1764 if (result->success) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 } | 1815 } |
1816 } | 1816 } |
1817 CheckGLError(); | 1817 CheckGLError(); |
1818 } | 1818 } |
1819 | 1819 |
1820 bool GLES2Implementation::GetActiveUniformHelper( | 1820 bool GLES2Implementation::GetActiveUniformHelper( |
1821 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, | 1821 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, |
1822 GLenum* type, char* name) { | 1822 GLenum* type, char* name) { |
1823 // Clear the bucket so if the command fails nothing will be in it. | 1823 // Clear the bucket so if the command fails nothing will be in it. |
1824 helper_->SetBucketSize(kResultBucketId, 0); | 1824 helper_->SetBucketSize(kResultBucketId, 0); |
1825 typedef gles2::GetActiveUniform::Result Result; | 1825 typedef cmds::GetActiveUniform::Result Result; |
1826 Result* result = GetResultAs<Result*>(); | 1826 Result* result = GetResultAs<Result*>(); |
1827 if (!result) { | 1827 if (!result) { |
1828 return false; | 1828 return false; |
1829 } | 1829 } |
1830 // Set as failed so if the command fails we'll recover. | 1830 // Set as failed so if the command fails we'll recover. |
1831 result->success = false; | 1831 result->success = false; |
1832 helper_->GetActiveUniform(program, index, kResultBucketId, | 1832 helper_->GetActiveUniform(program, index, kResultBucketId, |
1833 GetResultShmId(), GetResultShmOffset()); | 1833 GetResultShmId(), GetResultShmOffset()); |
1834 WaitForCmd(); | 1834 WaitForCmd(); |
1835 if (result->success) { | 1835 if (result->success) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1893 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1894 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttachedShaders(" | 1894 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttachedShaders(" |
1895 << program << ", " << maxcount << ", " | 1895 << program << ", " << maxcount << ", " |
1896 << static_cast<const void*>(count) << ", " | 1896 << static_cast<const void*>(count) << ", " |
1897 << static_cast<const void*>(shaders) << ", "); | 1897 << static_cast<const void*>(shaders) << ", "); |
1898 if (maxcount < 0) { | 1898 if (maxcount < 0) { |
1899 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders", "maxcount < 0"); | 1899 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders", "maxcount < 0"); |
1900 return; | 1900 return; |
1901 } | 1901 } |
1902 TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders"); | 1902 TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders"); |
1903 typedef gles2::GetAttachedShaders::Result Result; | 1903 typedef cmds::GetAttachedShaders::Result Result; |
1904 uint32 size = Result::ComputeSize(maxcount); | 1904 uint32 size = Result::ComputeSize(maxcount); |
1905 Result* result = static_cast<Result*>(transfer_buffer_->Alloc(size)); | 1905 Result* result = static_cast<Result*>(transfer_buffer_->Alloc(size)); |
1906 if (!result) { | 1906 if (!result) { |
1907 return; | 1907 return; |
1908 } | 1908 } |
1909 result->SetNumResults(0); | 1909 result->SetNumResults(0); |
1910 helper_->GetAttachedShaders( | 1910 helper_->GetAttachedShaders( |
1911 program, | 1911 program, |
1912 transfer_buffer_->GetShmId(), | 1912 transfer_buffer_->GetShmId(), |
1913 transfer_buffer_->GetOffset(result), | 1913 transfer_buffer_->GetOffset(result), |
(...skipping 15 matching lines...) Expand all Loading... |
1929 | 1929 |
1930 void GLES2Implementation::GetShaderPrecisionFormat( | 1930 void GLES2Implementation::GetShaderPrecisionFormat( |
1931 GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { | 1931 GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { |
1932 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 1932 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
1933 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderPrecisionFormat(" | 1933 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderPrecisionFormat(" |
1934 << GLES2Util::GetStringShaderType(shadertype) << ", " | 1934 << GLES2Util::GetStringShaderType(shadertype) << ", " |
1935 << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " | 1935 << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " |
1936 << static_cast<const void*>(range) << ", " | 1936 << static_cast<const void*>(range) << ", " |
1937 << static_cast<const void*>(precision) << ", "); | 1937 << static_cast<const void*>(precision) << ", "); |
1938 TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat"); | 1938 TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat"); |
1939 typedef gles2::GetShaderPrecisionFormat::Result Result; | 1939 typedef cmds::GetShaderPrecisionFormat::Result Result; |
1940 Result* result = GetResultAs<Result*>(); | 1940 Result* result = GetResultAs<Result*>(); |
1941 if (!result) { | 1941 if (!result) { |
1942 return; | 1942 return; |
1943 } | 1943 } |
1944 result->success = false; | 1944 result->success = false; |
1945 helper_->GetShaderPrecisionFormat( | 1945 helper_->GetShaderPrecisionFormat( |
1946 shadertype, precisiontype, GetResultShmId(), GetResultShmOffset()); | 1946 shadertype, precisiontype, GetResultShmId(), GetResultShmOffset()); |
1947 WaitForCmd(); | 1947 WaitForCmd(); |
1948 if (result->success) { | 1948 if (result->success) { |
1949 if (range) { | 1949 if (range) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 return result; | 2016 return result; |
2017 } | 2017 } |
2018 | 2018 |
2019 void GLES2Implementation::GetUniformfv( | 2019 void GLES2Implementation::GetUniformfv( |
2020 GLuint program, GLint location, GLfloat* params) { | 2020 GLuint program, GLint location, GLfloat* params) { |
2021 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2021 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2022 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformfv(" | 2022 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformfv(" |
2023 << program << ", " << location << ", " | 2023 << program << ", " << location << ", " |
2024 << static_cast<const void*>(params) << ")"); | 2024 << static_cast<const void*>(params) << ")"); |
2025 TRACE_EVENT0("gpu", "GLES2::GetUniformfv"); | 2025 TRACE_EVENT0("gpu", "GLES2::GetUniformfv"); |
2026 typedef gles2::GetUniformfv::Result Result; | 2026 typedef cmds::GetUniformfv::Result Result; |
2027 Result* result = GetResultAs<Result*>(); | 2027 Result* result = GetResultAs<Result*>(); |
2028 if (!result) { | 2028 if (!result) { |
2029 return; | 2029 return; |
2030 } | 2030 } |
2031 result->SetNumResults(0); | 2031 result->SetNumResults(0); |
2032 helper_->GetUniformfv( | 2032 helper_->GetUniformfv( |
2033 program, location, GetResultShmId(), GetResultShmOffset()); | 2033 program, location, GetResultShmId(), GetResultShmOffset()); |
2034 WaitForCmd(); | 2034 WaitForCmd(); |
2035 result->CopyResult(params); | 2035 result->CopyResult(params); |
2036 GPU_CLIENT_LOG_CODE_BLOCK({ | 2036 GPU_CLIENT_LOG_CODE_BLOCK({ |
2037 for (int32 i = 0; i < result->GetNumResults(); ++i) { | 2037 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
2038 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); | 2038 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
2039 } | 2039 } |
2040 }); | 2040 }); |
2041 CheckGLError(); | 2041 CheckGLError(); |
2042 } | 2042 } |
2043 | 2043 |
2044 void GLES2Implementation::GetUniformiv( | 2044 void GLES2Implementation::GetUniformiv( |
2045 GLuint program, GLint location, GLint* params) { | 2045 GLuint program, GLint location, GLint* params) { |
2046 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2046 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2047 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformiv(" | 2047 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformiv(" |
2048 << program << ", " << location << ", " | 2048 << program << ", " << location << ", " |
2049 << static_cast<const void*>(params) << ")"); | 2049 << static_cast<const void*>(params) << ")"); |
2050 TRACE_EVENT0("gpu", "GLES2::GetUniformiv"); | 2050 TRACE_EVENT0("gpu", "GLES2::GetUniformiv"); |
2051 typedef gles2::GetUniformiv::Result Result; | 2051 typedef cmds::GetUniformiv::Result Result; |
2052 Result* result = GetResultAs<Result*>(); | 2052 Result* result = GetResultAs<Result*>(); |
2053 if (!result) { | 2053 if (!result) { |
2054 return; | 2054 return; |
2055 } | 2055 } |
2056 result->SetNumResults(0); | 2056 result->SetNumResults(0); |
2057 helper_->GetUniformiv( | 2057 helper_->GetUniformiv( |
2058 program, location, GetResultShmId(), GetResultShmOffset()); | 2058 program, location, GetResultShmId(), GetResultShmOffset()); |
2059 WaitForCmd(); | 2059 WaitForCmd(); |
2060 GetResultAs<gles2::GetUniformfv::Result*>()->CopyResult(params); | 2060 GetResultAs<cmds::GetUniformfv::Result*>()->CopyResult(params); |
2061 GPU_CLIENT_LOG_CODE_BLOCK({ | 2061 GPU_CLIENT_LOG_CODE_BLOCK({ |
2062 for (int32 i = 0; i < result->GetNumResults(); ++i) { | 2062 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
2063 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); | 2063 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
2064 } | 2064 } |
2065 }); | 2065 }); |
2066 CheckGLError(); | 2066 CheckGLError(); |
2067 } | 2067 } |
2068 | 2068 |
2069 void GLES2Implementation::ReadPixels( | 2069 void GLES2Implementation::ReadPixels( |
2070 GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, | 2070 GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, |
(...skipping 13 matching lines...) Expand all Loading... |
2084 return; | 2084 return; |
2085 } | 2085 } |
2086 | 2086 |
2087 // glReadPixel pads the size of each row of pixels by an amount specified by | 2087 // glReadPixel pads the size of each row of pixels by an amount specified by |
2088 // glPixelStorei. So, we have to take that into account both in the fact that | 2088 // glPixelStorei. So, we have to take that into account both in the fact that |
2089 // the pixels returned from the ReadPixel command will include that padding | 2089 // the pixels returned from the ReadPixel command will include that padding |
2090 // and that when we copy the results to the user's buffer we need to not | 2090 // and that when we copy the results to the user's buffer we need to not |
2091 // write those padding bytes but leave them as they are. | 2091 // write those padding bytes but leave them as they are. |
2092 | 2092 |
2093 TRACE_EVENT0("gpu", "GLES2::ReadPixels"); | 2093 TRACE_EVENT0("gpu", "GLES2::ReadPixels"); |
2094 typedef gles2::ReadPixels::Result Result; | 2094 typedef cmds::ReadPixels::Result Result; |
2095 | 2095 |
2096 int8* dest = reinterpret_cast<int8*>(pixels); | 2096 int8* dest = reinterpret_cast<int8*>(pixels); |
2097 uint32 temp_size; | 2097 uint32 temp_size; |
2098 uint32 unpadded_row_size; | 2098 uint32 unpadded_row_size; |
2099 uint32 padded_row_size; | 2099 uint32 padded_row_size; |
2100 if (!GLES2Util::ComputeImageDataSizes( | 2100 if (!GLES2Util::ComputeImageDataSizes( |
2101 width, 2, format, type, pack_alignment_, &temp_size, &unpadded_row_size, | 2101 width, 2, format, type, pack_alignment_, &temp_size, &unpadded_row_size, |
2102 &padded_row_size)) { | 2102 &padded_row_size)) { |
2103 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); | 2103 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); |
2104 return; | 2104 return; |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribfv(" | 2510 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribfv(" |
2511 << index << ", " | 2511 << index << ", " |
2512 << GLES2Util::GetStringVertexAttribute(pname) << ", " | 2512 << GLES2Util::GetStringVertexAttribute(pname) << ", " |
2513 << static_cast<const void*>(params) << ")"); | 2513 << static_cast<const void*>(params) << ")"); |
2514 uint32 value = 0; | 2514 uint32 value = 0; |
2515 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { | 2515 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { |
2516 *params = static_cast<float>(value); | 2516 *params = static_cast<float>(value); |
2517 return; | 2517 return; |
2518 } | 2518 } |
2519 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv"); | 2519 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv"); |
2520 typedef GetVertexAttribfv::Result Result; | 2520 typedef cmds::GetVertexAttribfv::Result Result; |
2521 Result* result = GetResultAs<Result*>(); | 2521 Result* result = GetResultAs<Result*>(); |
2522 if (!result) { | 2522 if (!result) { |
2523 return; | 2523 return; |
2524 } | 2524 } |
2525 result->SetNumResults(0); | 2525 result->SetNumResults(0); |
2526 helper_->GetVertexAttribfv( | 2526 helper_->GetVertexAttribfv( |
2527 index, pname, GetResultShmId(), GetResultShmOffset()); | 2527 index, pname, GetResultShmId(), GetResultShmOffset()); |
2528 WaitForCmd(); | 2528 WaitForCmd(); |
2529 result->CopyResult(params); | 2529 result->CopyResult(params); |
2530 GPU_CLIENT_LOG_CODE_BLOCK({ | 2530 GPU_CLIENT_LOG_CODE_BLOCK({ |
(...skipping 10 matching lines...) Expand all Loading... |
2541 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribiv(" | 2541 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribiv(" |
2542 << index << ", " | 2542 << index << ", " |
2543 << GLES2Util::GetStringVertexAttribute(pname) << ", " | 2543 << GLES2Util::GetStringVertexAttribute(pname) << ", " |
2544 << static_cast<const void*>(params) << ")"); | 2544 << static_cast<const void*>(params) << ")"); |
2545 uint32 value = 0; | 2545 uint32 value = 0; |
2546 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { | 2546 if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) { |
2547 *params = value; | 2547 *params = value; |
2548 return; | 2548 return; |
2549 } | 2549 } |
2550 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv"); | 2550 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv"); |
2551 typedef GetVertexAttribiv::Result Result; | 2551 typedef cmds::GetVertexAttribiv::Result Result; |
2552 Result* result = GetResultAs<Result*>(); | 2552 Result* result = GetResultAs<Result*>(); |
2553 if (!result) { | 2553 if (!result) { |
2554 return; | 2554 return; |
2555 } | 2555 } |
2556 result->SetNumResults(0); | 2556 result->SetNumResults(0); |
2557 helper_->GetVertexAttribiv( | 2557 helper_->GetVertexAttribiv( |
2558 index, pname, GetResultShmId(), GetResultShmOffset()); | 2558 index, pname, GetResultShmId(), GetResultShmOffset()); |
2559 WaitForCmd(); | 2559 WaitForCmd(); |
2560 result->CopyResult(params); | 2560 result->CopyResult(params); |
2561 GPU_CLIENT_LOG_CODE_BLOCK({ | 2561 GPU_CLIENT_LOG_CODE_BLOCK({ |
2562 for (int32 i = 0; i < result->GetNumResults(); ++i) { | 2562 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
2563 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); | 2563 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
2564 } | 2564 } |
2565 }); | 2565 }); |
2566 CheckGLError(); | 2566 CheckGLError(); |
2567 } | 2567 } |
2568 | 2568 |
2569 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( | 2569 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( |
2570 const char* feature) { | 2570 const char* feature) { |
2571 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2571 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2572 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" | 2572 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" |
2573 << feature << ")"); | 2573 << feature << ")"); |
2574 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); | 2574 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); |
2575 typedef EnableFeatureCHROMIUM::Result Result; | 2575 typedef cmds::EnableFeatureCHROMIUM::Result Result; |
2576 Result* result = GetResultAs<Result*>(); | 2576 Result* result = GetResultAs<Result*>(); |
2577 if (!result) { | 2577 if (!result) { |
2578 return false; | 2578 return false; |
2579 } | 2579 } |
2580 *result = 0; | 2580 *result = 0; |
2581 SetBucketAsCString(kResultBucketId, feature); | 2581 SetBucketAsCString(kResultBucketId, feature); |
2582 helper_->EnableFeatureCHROMIUM( | 2582 helper_->EnableFeatureCHROMIUM( |
2583 kResultBucketId, GetResultShmId(), GetResultShmOffset()); | 2583 kResultBucketId, GetResultShmId(), GetResultShmOffset()); |
2584 WaitForCmd(); | 2584 WaitForCmd(); |
2585 helper_->SetBucketSize(kResultBucketId, 0); | 2585 helper_->SetBucketSize(kResultBucketId, 0); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2901 return; | 2901 return; |
2902 } | 2902 } |
2903 memcpy(info, &result[0], result.size()); | 2903 memcpy(info, &result[0], result.size()); |
2904 } | 2904 } |
2905 | 2905 |
2906 GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) { | 2906 GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) { |
2907 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2907 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
2908 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CreateStreamTextureCHROMIUM(" | 2908 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CreateStreamTextureCHROMIUM(" |
2909 << texture << ")"); | 2909 << texture << ")"); |
2910 TRACE_EVENT0("gpu", "GLES2::CreateStreamTextureCHROMIUM"); | 2910 TRACE_EVENT0("gpu", "GLES2::CreateStreamTextureCHROMIUM"); |
2911 typedef CreateStreamTextureCHROMIUM::Result Result; | 2911 typedef cmds::CreateStreamTextureCHROMIUM::Result Result; |
2912 Result* result = GetResultAs<Result*>(); | 2912 Result* result = GetResultAs<Result*>(); |
2913 if (!result) { | 2913 if (!result) { |
2914 return GL_ZERO; | 2914 return GL_ZERO; |
2915 } | 2915 } |
2916 *result = GL_ZERO; | 2916 *result = GL_ZERO; |
2917 | 2917 |
2918 helper_->CreateStreamTextureCHROMIUM(texture, | 2918 helper_->CreateStreamTextureCHROMIUM(texture, |
2919 GetResultShmId(), | 2919 GetResultShmId(), |
2920 GetResultShmOffset()); | 2920 GetResultShmOffset()); |
2921 WaitForCmd(); | 2921 WaitForCmd(); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3439 return; | 3439 return; |
3440 } | 3440 } |
3441 | 3441 |
3442 // Include the auto-generated part of this file. We split this because it means | 3442 // Include the auto-generated part of this file. We split this because it means |
3443 // we can easily edit the non-auto generated parts right here in this file | 3443 // we can easily edit the non-auto generated parts right here in this file |
3444 // instead of having to edit some template or the code generator. | 3444 // instead of having to edit some template or the code generator. |
3445 #include "../client/gles2_implementation_impl_autogen.h" | 3445 #include "../client/gles2_implementation_impl_autogen.h" |
3446 | 3446 |
3447 } // namespace gles2 | 3447 } // namespace gles2 |
3448 } // namespace gpu | 3448 } // namespace gpu |
OLD | NEW |