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 6073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6084 GLint* location = GetSharedMemoryAs<GLint*>( | 6084 GLint* location = GetSharedMemoryAs<GLint*>( |
6085 location_shm_id, location_shm_offset, sizeof(GLint)); | 6085 location_shm_id, location_shm_offset, sizeof(GLint)); |
6086 if (!location) { | 6086 if (!location) { |
6087 return error::kOutOfBounds; | 6087 return error::kOutOfBounds; |
6088 } | 6088 } |
6089 // Require the client to init this incase the context is lost an we are no | 6089 // Require the client to init this incase the context is lost an we are no |
6090 // longer executing commands. | 6090 // longer executing commands. |
6091 if (*location != -1) { | 6091 if (*location != -1) { |
6092 return error::kGenericError; | 6092 return error::kGenericError; |
6093 } | 6093 } |
6094 *location = info->GetUniformLocation(name_str); | 6094 *location = program_manager()->SwizzleLocation( |
| 6095 info->GetUniformLocation(name_str)); |
6095 return error::kNoError; | 6096 return error::kNoError; |
6096 } | 6097 } |
6097 | 6098 |
6098 error::Error GLES2DecoderImpl::HandleGetUniformLocation( | 6099 error::Error GLES2DecoderImpl::HandleGetUniformLocation( |
6099 uint32 immediate_data_size, const gles2::GetUniformLocation& c) { | 6100 uint32 immediate_data_size, const gles2::GetUniformLocation& c) { |
6100 uint32 name_size = c.data_size; | 6101 uint32 name_size = c.data_size; |
6101 const char* name = GetSharedMemoryAs<const char*>( | 6102 const char* name = GetSharedMemoryAs<const char*>( |
6102 c.name_shm_id, c.name_shm_offset, name_size); | 6103 c.name_shm_id, c.name_shm_offset, name_size); |
6103 if (!name) { | 6104 if (!name) { |
6104 return error::kOutOfBounds; | 6105 return error::kOutOfBounds; |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7122 return false; | 7123 return false; |
7123 } | 7124 } |
7124 result->size = size; | 7125 result->size = size; |
7125 *result_type = type; | 7126 *result_type = type; |
7126 return true; | 7127 return true; |
7127 } | 7128 } |
7128 | 7129 |
7129 error::Error GLES2DecoderImpl::HandleGetUniformiv( | 7130 error::Error GLES2DecoderImpl::HandleGetUniformiv( |
7130 uint32 immediate_data_size, const gles2::GetUniformiv& c) { | 7131 uint32 immediate_data_size, const gles2::GetUniformiv& c) { |
7131 GLuint program = c.program; | 7132 GLuint program = c.program; |
7132 GLint location = c.location; | 7133 GLint location = program_manager()->UnswizzleLocation(c.location); |
7133 GLuint service_id; | 7134 GLuint service_id; |
7134 GLenum result_type; | 7135 GLenum result_type; |
7135 Error error; | 7136 Error error; |
7136 void* result; | 7137 void* result; |
7137 if (GetUniformSetup( | 7138 if (GetUniformSetup( |
7138 program, location, c.params_shm_id, c.params_shm_offset, | 7139 program, location, c.params_shm_id, c.params_shm_offset, |
7139 &error, &service_id, &result, &result_type)) { | 7140 &error, &service_id, &result, &result_type)) { |
7140 glGetUniformiv( | 7141 glGetUniformiv( |
7141 service_id, location, | 7142 service_id, location, |
7142 static_cast<gles2::GetUniformiv::Result*>(result)->GetData()); | 7143 static_cast<gles2::GetUniformiv::Result*>(result)->GetData()); |
7143 } | 7144 } |
7144 return error; | 7145 return error; |
7145 } | 7146 } |
7146 | 7147 |
7147 error::Error GLES2DecoderImpl::HandleGetUniformfv( | 7148 error::Error GLES2DecoderImpl::HandleGetUniformfv( |
7148 uint32 immediate_data_size, const gles2::GetUniformfv& c) { | 7149 uint32 immediate_data_size, const gles2::GetUniformfv& c) { |
7149 GLuint program = c.program; | 7150 GLuint program = c.program; |
7150 GLint location = c.location; | 7151 GLint location = program_manager()->UnswizzleLocation(c.location); |
7151 GLuint service_id; | 7152 GLuint service_id; |
7152 Error error; | 7153 Error error; |
7153 typedef gles2::GetUniformfv::Result Result; | 7154 typedef gles2::GetUniformfv::Result Result; |
7154 Result* result; | 7155 Result* result; |
7155 GLenum result_type; | 7156 GLenum result_type; |
7156 if (GetUniformSetup( | 7157 if (GetUniformSetup( |
7157 program, location, c.params_shm_id, c.params_shm_offset, | 7158 program, location, c.params_shm_id, c.params_shm_offset, |
7158 &error, &service_id, reinterpret_cast<void**>(&result), &result_type)) { | 7159 &error, &service_id, reinterpret_cast<void**>(&result), &result_type)) { |
7159 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || | 7160 if (result_type == GL_BOOL || result_type == GL_BOOL_VEC2 || |
7160 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { | 7161 result_type == GL_BOOL_VEC3 || result_type == GL_BOOL_VEC4) { |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7644 uint32 immediate_data_size, const gles2::GetProgramInfoCHROMIUM& c) { | 7645 uint32 immediate_data_size, const gles2::GetProgramInfoCHROMIUM& c) { |
7645 GLuint program = static_cast<GLuint>(c.program); | 7646 GLuint program = static_cast<GLuint>(c.program); |
7646 uint32 bucket_id = c.bucket_id; | 7647 uint32 bucket_id = c.bucket_id; |
7647 Bucket* bucket = CreateBucket(bucket_id); | 7648 Bucket* bucket = CreateBucket(bucket_id); |
7648 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. | 7649 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. |
7649 ProgramManager::ProgramInfo* info = NULL; | 7650 ProgramManager::ProgramInfo* info = NULL; |
7650 info = GetProgramInfo(program); | 7651 info = GetProgramInfo(program); |
7651 if (!info || !info->IsValid()) { | 7652 if (!info || !info->IsValid()) { |
7652 return error::kNoError; | 7653 return error::kNoError; |
7653 } | 7654 } |
7654 info->GetProgramInfo(bucket); | 7655 info->GetProgramInfo(program_manager(), bucket); |
7655 return error::kNoError; | 7656 return error::kNoError; |
7656 } | 7657 } |
7657 | 7658 |
7658 error::ContextLostReason GLES2DecoderImpl::GetContextLostReason() { | 7659 error::ContextLostReason GLES2DecoderImpl::GetContextLostReason() { |
7659 switch (reset_status_) { | 7660 switch (reset_status_) { |
7660 case GL_NO_ERROR: | 7661 case GL_NO_ERROR: |
7661 // TODO(kbr): improve the precision of the error code in this case. | 7662 // TODO(kbr): improve the precision of the error code in this case. |
7662 // Consider delegating to context for error code if MakeCurrent fails. | 7663 // Consider delegating to context for error code if MakeCurrent fails. |
7663 return error::kUnknown; | 7664 return error::kUnknown; |
7664 case GL_GUILTY_CONTEXT_RESET_ARB: | 7665 case GL_GUILTY_CONTEXT_RESET_ARB: |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8007 } | 8008 } |
8008 } | 8009 } |
8009 | 8010 |
8010 // Include the auto-generated part of this file. We split this because it means | 8011 // Include the auto-generated part of this file. We split this because it means |
8011 // we can easily edit the non-auto generated parts right here in this file | 8012 // we can easily edit the non-auto generated parts right here in this file |
8012 // instead of having to edit some template or the code generator. | 8013 // instead of having to edit some template or the code generator. |
8013 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8014 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8014 | 8015 |
8015 } // namespace gles2 | 8016 } // namespace gles2 |
8016 } // namespace gpu | 8017 } // namespace gpu |
OLD | NEW |