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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 4911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4922 } | 4922 } |
4923 | 4923 |
4924 void GLES2DecoderImpl::LogMessage(const std::string& msg) { | 4924 void GLES2DecoderImpl::LogMessage(const std::string& msg) { |
4925 if (log_message_count_ < kMaxLogMessages || | 4925 if (log_message_count_ < kMaxLogMessages || |
4926 CommandLine::ForCurrentProcess()->HasSwitch( | 4926 CommandLine::ForCurrentProcess()->HasSwitch( |
4927 switches::kDisableGLErrorLimit)) { | 4927 switches::kDisableGLErrorLimit)) { |
4928 ++log_message_count_; | 4928 ++log_message_count_; |
4929 // LOG this unless logging is turned off as any chromium code that | 4929 // LOG this unless logging is turned off as any chromium code that |
4930 // generates these errors probably has a bug. | 4930 // generates these errors probably has a bug. |
4931 if (log_synthesized_gl_errors()) { | 4931 if (log_synthesized_gl_errors()) { |
4932 LOG(ERROR) << last_error_; | 4932 LOG(ERROR) << msg; |
4933 } | 4933 } |
4934 if (!msg_callback_.is_null()) { | 4934 if (!msg_callback_.is_null()) { |
4935 msg_callback_.Run(0, msg); | 4935 msg_callback_.Run(0, msg); |
4936 } | 4936 } |
4937 } else { | 4937 } else { |
4938 if (log_message_count_ == kMaxLogMessages) { | 4938 if (log_message_count_ == kMaxLogMessages) { |
4939 ++log_message_count_; | 4939 ++log_message_count_; |
4940 LOG(ERROR) | 4940 LOG(ERROR) |
4941 << "Too many GL errors, not reporting any more for this context." | 4941 << "Too many GL errors, not reporting any more for this context." |
4942 << " use --disable-gl-error-limit to see all errors."; | 4942 << " use --disable-gl-error-limit to see all errors."; |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6497 GLint* location = GetSharedMemoryAs<GLint*>( | 6497 GLint* location = GetSharedMemoryAs<GLint*>( |
6498 location_shm_id, location_shm_offset, sizeof(GLint)); | 6498 location_shm_id, location_shm_offset, sizeof(GLint)); |
6499 if (!location) { | 6499 if (!location) { |
6500 return error::kOutOfBounds; | 6500 return error::kOutOfBounds; |
6501 } | 6501 } |
6502 // Require the client to init this incase the context is lost an we are no | 6502 // Require the client to init this incase the context is lost an we are no |
6503 // longer executing commands. | 6503 // longer executing commands. |
6504 if (*location != -1) { | 6504 if (*location != -1) { |
6505 return error::kGenericError; | 6505 return error::kGenericError; |
6506 } | 6506 } |
6507 *location = program_manager()->SwizzleLocation( | 6507 *location = GLES2Util::SwizzleLocation( |
6508 info->GetUniformFakeLocation(name_str)); | 6508 info->GetUniformFakeLocation(name_str)); |
6509 return error::kNoError; | 6509 return error::kNoError; |
6510 } | 6510 } |
6511 | 6511 |
6512 error::Error GLES2DecoderImpl::HandleGetUniformLocation( | 6512 error::Error GLES2DecoderImpl::HandleGetUniformLocation( |
6513 uint32 immediate_data_size, const gles2::GetUniformLocation& c) { | 6513 uint32 immediate_data_size, const gles2::GetUniformLocation& c) { |
6514 uint32 name_size = c.data_size; | 6514 uint32 name_size = c.data_size; |
6515 const char* name = GetSharedMemoryAs<const char*>( | 6515 const char* name = GetSharedMemoryAs<const char*>( |
6516 c.name_shm_id, c.name_shm_offset, name_size); | 6516 c.name_shm_id, c.name_shm_offset, name_size); |
6517 if (!name) { | 6517 if (!name) { |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7806 return false; | 7806 return false; |
7807 } | 7807 } |
7808 result->size = size; | 7808 result->size = size; |
7809 *result_type = type; | 7809 *result_type = type; |
7810 return true; | 7810 return true; |
7811 } | 7811 } |
7812 | 7812 |
7813 error::Error GLES2DecoderImpl::HandleGetUniformiv( | 7813 error::Error GLES2DecoderImpl::HandleGetUniformiv( |
7814 uint32 immediate_data_size, const gles2::GetUniformiv& c) { | 7814 uint32 immediate_data_size, const gles2::GetUniformiv& c) { |
7815 GLuint program = c.program; | 7815 GLuint program = c.program; |
7816 GLint fake_location = program_manager()->UnswizzleLocation(c.location); | 7816 GLint fake_location = GLES2Util::UnswizzleLocation(c.location); |
7817 GLuint service_id; | 7817 GLuint service_id; |
7818 GLenum result_type; | 7818 GLenum result_type; |
7819 GLint real_location = -1; | 7819 GLint real_location = -1; |
7820 Error error; | 7820 Error error; |
7821 void* result; | 7821 void* result; |
7822 if (GetUniformSetup( | 7822 if (GetUniformSetup( |
7823 program, fake_location, c.params_shm_id, c.params_shm_offset, | 7823 program, fake_location, c.params_shm_id, c.params_shm_offset, |
7824 &error, &real_location, &service_id, &result, &result_type)) { | 7824 &error, &real_location, &service_id, &result, &result_type)) { |
7825 glGetUniformiv( | 7825 glGetUniformiv( |
7826 service_id, real_location, | 7826 service_id, real_location, |
7827 static_cast<gles2::GetUniformiv::Result*>(result)->GetData()); | 7827 static_cast<gles2::GetUniformiv::Result*>(result)->GetData()); |
7828 } | 7828 } |
7829 return error; | 7829 return error; |
7830 } | 7830 } |
7831 | 7831 |
7832 error::Error GLES2DecoderImpl::HandleGetUniformfv( | 7832 error::Error GLES2DecoderImpl::HandleGetUniformfv( |
7833 uint32 immediate_data_size, const gles2::GetUniformfv& c) { | 7833 uint32 immediate_data_size, const gles2::GetUniformfv& c) { |
7834 GLuint program = c.program; | 7834 GLuint program = c.program; |
7835 GLint fake_location = program_manager()->UnswizzleLocation(c.location); | 7835 GLint fake_location = GLES2Util::UnswizzleLocation(c.location); |
7836 GLuint service_id; | 7836 GLuint service_id; |
7837 GLint real_location = -1; | 7837 GLint real_location = -1; |
7838 Error error; | 7838 Error error; |
7839 typedef gles2::GetUniformfv::Result Result; | 7839 typedef gles2::GetUniformfv::Result Result; |
7840 Result* result; | 7840 Result* result; |
7841 GLenum result_type; | 7841 GLenum result_type; |
7842 if (GetUniformSetup( | 7842 if (GetUniformSetup( |
7843 program, fake_location, c.params_shm_id, c.params_shm_offset, | 7843 program, fake_location, c.params_shm_id, c.params_shm_offset, |
7844 &error, &real_location, &service_id, | 7844 &error, &real_location, &service_id, |
7845 reinterpret_cast<void**>(&result), &result_type)) { | 7845 reinterpret_cast<void**>(&result), &result_type)) { |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9012 BindAndApplyTextureParameters(info); | 9012 BindAndApplyTextureParameters(info); |
9013 } | 9013 } |
9014 | 9014 |
9015 // Include the auto-generated part of this file. We split this because it means | 9015 // Include the auto-generated part of this file. We split this because it means |
9016 // we can easily edit the non-auto generated parts right here in this file | 9016 // we can easily edit the non-auto generated parts right here in this file |
9017 // instead of having to edit some template or the code generator. | 9017 // instead of having to edit some template or the code generator. |
9018 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 9018 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
9019 | 9019 |
9020 } // namespace gles2 | 9020 } // namespace gles2 |
9021 } // namespace gpu | 9021 } // namespace gpu |
OLD | NEW |