OLD | NEW |
1 /* | 1 /* |
2 * Mesa 3-D graphics library | 2 * Mesa 3-D graphics library |
3 * Version: 7.3 | 3 * Version: 7.3 |
4 * | 4 * |
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. | 5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. |
6 * | 6 * |
7 * Permission is hereby granted, free of charge, to any person obtaining a | 7 * Permission is hereby granted, free of charge, to any person obtaining a |
8 * copy of this software and associated documentation files (the "Software"), | 8 * copy of this software and associated documentation files (the "Software"), |
9 * to deal in the Software without restriction, including without limitation | 9 * to deal in the Software without restriction, including without limitation |
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 sz4 * sizeof(struct gl_program_parameter)); | 151 sz4 * sizeof(struct gl_program_parameter)); |
152 | 152 |
153 for (i = 0; i < sz4; i++) { | 153 for (i = 0; i < sz4; i++) { |
154 struct gl_program_parameter *p = paramList->Parameters + oldNum + i; | 154 struct gl_program_parameter *p = paramList->Parameters + oldNum + i; |
155 p->Name = name ? _mesa_strdup(name) : NULL; | 155 p->Name = name ? _mesa_strdup(name) : NULL; |
156 p->Type = type; | 156 p->Type = type; |
157 p->Size = size; | 157 p->Size = size; |
158 p->DataType = datatype; | 158 p->DataType = datatype; |
159 p->Flags = flags; | 159 p->Flags = flags; |
160 if (values) { | 160 if (values) { |
161 COPY_4V(paramList->ParameterValues[oldNum + i], values); | 161 if (size >= (i+1)*4) { |
| 162 COPY_4V(paramList->ParameterValues[oldNum + i], values); |
| 163 } else { |
| 164 /* silence asan */ |
| 165 for (j = 0; j < 4; j++) { |
| 166 if (i*4+j < size) { |
| 167 paramList->ParameterValues[oldNum + i][j] = values[i*4+j]; |
| 168 } else { |
| 169 paramList->ParameterValues[oldNum + i][j].f = 0.0f; |
| 170 } |
| 171 } |
| 172 } |
162 values += 4; | 173 values += 4; |
163 p->Initialized = GL_TRUE; | 174 p->Initialized = GL_TRUE; |
164 } | 175 } |
165 else { | 176 else { |
166 /* silence valgrind */ | 177 /* silence valgrind */ |
167 for (j = 0; j < 4; j++) | 178 for (j = 0; j < 4; j++) |
168 paramList->ParameterValues[oldNum + i][j].f = 0; | 179 paramList->ParameterValues[oldNum + i][j].f = 0; |
169 } | 180 } |
170 size -= 4; | 181 size -= 4; |
171 } | 182 } |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 { | 660 { |
650 GLuint i, count = 0; | 661 GLuint i, count = 0; |
651 if (list) { | 662 if (list) { |
652 for (i = 0; i < list->NumParameters; i++) { | 663 for (i = 0; i < list->NumParameters; i++) { |
653 if (list->Parameters[i].Type == type) | 664 if (list->Parameters[i].Type == type) |
654 count++; | 665 count++; |
655 } | 666 } |
656 } | 667 } |
657 return count; | 668 return count; |
658 } | 669 } |
OLD | NEW |