| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/output/program_binding.h" | 5 #include "cc/output/program_binding.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "cc/output/geometry_binding.h" | 8 #include "cc/output/geometry_binding.h" |
| 9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
| 10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (!shader) | 81 if (!shader) |
| 82 return 0u; | 82 return 0u; |
| 83 | 83 |
| 84 const char* shader_source_str[] = { shader_source.data() }; | 84 const char* shader_source_str[] = { shader_source.data() }; |
| 85 int shader_length[] = { static_cast<int>(shader_source.length()) }; | 85 int shader_length[] = { static_cast<int>(shader_source.length()) }; |
| 86 context->ShaderSource( | 86 context->ShaderSource( |
| 87 shader, 1, | 87 shader, 1, |
| 88 shader_source_str, | 88 shader_source_str, |
| 89 shader_length); | 89 shader_length); |
| 90 context->CompileShader(shader); | 90 context->CompileShader(shader); |
| 91 #ifndef NDEBUG | 91 #if DCHECK_IS_ON() |
| 92 int compiled = 0; | 92 int compiled = 0; |
| 93 context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled); | 93 context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled); |
| 94 if (!compiled) | 94 if (!compiled) |
| 95 return 0u; | 95 return 0u; |
| 96 #endif | 96 #endif |
| 97 return shader; | 97 return shader; |
| 98 } | 98 } |
| 99 | 99 |
| 100 unsigned ProgramBindingBase::CreateShaderProgram(GLES2Interface* context, | 100 unsigned ProgramBindingBase::CreateShaderProgram(GLES2Interface* context, |
| 101 unsigned vertex_shader, | 101 unsigned vertex_shader, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 128 context->DeleteShader(fragment_shader_id_); | 128 context->DeleteShader(fragment_shader_id_); |
| 129 fragment_shader_id_ = 0; | 129 fragment_shader_id_ = 0; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { | 133 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { |
| 134 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 134 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace cc | 137 } // namespace cc |
| OLD | NEW |