OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/renderer_host/compositing_iosurface_shader_programs_ma
c.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_shader_programs_ma
c.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 #ifndef NDEBUG | 351 #ifndef NDEBUG |
352 for (size_t i = 0; i < arraysize(shader_programs_); ++i) | 352 for (size_t i = 0; i < arraysize(shader_programs_); ++i) |
353 DCHECK_EQ(shader_programs_[i], 0u) << "Failed to call Reset()."; | 353 DCHECK_EQ(shader_programs_[i], 0u) << "Failed to call Reset()."; |
354 #endif | 354 #endif |
355 } | 355 } |
356 | 356 |
357 void CompositingIOSurfaceShaderPrograms::Reset() { | 357 void CompositingIOSurfaceShaderPrograms::Reset() { |
358 for (size_t i = 0; i < arraysize(shader_programs_); ++i) { | 358 for (size_t i = 0; i < arraysize(shader_programs_); ++i) { |
359 if (shader_programs_[i] != 0u) { | 359 if (shader_programs_[i] != 0u) { |
360 glDeleteProgram(shader_programs_[i]); | 360 glDeleteProgram(shader_programs_[i]); |
361 DCHECK(glGetError() == GL_NO_ERROR) | |
362 << "when calling glDeleteProgram(shader_programs_[" << i << "])"; | |
363 shader_programs_[i] = 0u; | 361 shader_programs_[i] = 0u; |
364 } | 362 } |
365 } | 363 } |
366 for (size_t i = 0; i < arraysize(texture_var_locations_); ++i) | 364 for (size_t i = 0; i < arraysize(texture_var_locations_); ++i) |
367 texture_var_locations_[i] = -1; | 365 texture_var_locations_[i] = -1; |
368 for (size_t i = 0; i < arraysize(texel_scale_x_var_locations_); ++i) | 366 for (size_t i = 0; i < arraysize(texel_scale_x_var_locations_); ++i) |
369 texel_scale_x_var_locations_[i] = -1; | 367 texel_scale_x_var_locations_[i] = -1; |
370 } | 368 } |
371 | 369 |
372 bool CompositingIOSurfaceShaderPrograms::UseBlitProgram() { | 370 bool CompositingIOSurfaceShaderPrograms::UseBlitProgram() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (texel_scale_x_var_locations_[which] == -1) { | 439 if (texel_scale_x_var_locations_[which] == -1) { |
442 texel_scale_x_var_locations_[which] = | 440 texel_scale_x_var_locations_[which] = |
443 glGetUniformLocation(GetShaderProgram(which), "texel_scale_x_"); | 441 glGetUniformLocation(GetShaderProgram(which), "texel_scale_x_"); |
444 DCHECK_NE(texel_scale_x_var_locations_[which], -1) | 442 DCHECK_NE(texel_scale_x_var_locations_[which], -1) |
445 << "Failed to find location of uniform variable: texel_scale_x_"; | 443 << "Failed to find location of uniform variable: texel_scale_x_"; |
446 } | 444 } |
447 glUniform1f(texel_scale_x_var_locations_[which], texel_scale_x); | 445 glUniform1f(texel_scale_x_var_locations_[which], texel_scale_x); |
448 } | 446 } |
449 | 447 |
450 } // namespace content | 448 } // namespace content |
OLD | NEW |