Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: cc/output/program_binding.cc

Issue 2600113002: Initialize arrays before use. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 bool ProgramBindingBase::Link(GLES2Interface* context) { 51 bool ProgramBindingBase::Link(GLES2Interface* context) {
52 context->LinkProgram(program_); 52 context->LinkProgram(program_);
53 CleanupShaders(context); 53 CleanupShaders(context);
54 if (!program_) 54 if (!program_)
55 return false; 55 return false;
56 #ifndef NDEBUG 56 #ifndef NDEBUG
57 int linked = 0; 57 int linked = 0;
58 context->GetProgramiv(program_, GL_LINK_STATUS, &linked); 58 context->GetProgramiv(program_, GL_LINK_STATUS, &linked);
59 if (!linked) { 59 if (!linked) {
60 char buffer[1024]; 60 char buffer[1024] = "";
61 context->GetProgramInfoLog(program_, sizeof(buffer), nullptr, buffer); 61 context->GetProgramInfoLog(program_, sizeof(buffer), nullptr, buffer);
62 DLOG(ERROR) << "Error compiling shader: " << buffer; 62 DLOG(ERROR) << "Error compiling shader: " << buffer;
63 return false; 63 return false;
64 } 64 }
65 #endif 65 #endif
66 return true; 66 return true;
67 } 67 }
68 68
69 void ProgramBindingBase::Cleanup(GLES2Interface* context) { 69 void ProgramBindingBase::Cleanup(GLES2Interface* context) {
70 initialized_ = false; 70 initialized_ = false;
(...skipping 18 matching lines...) Expand all
89 int shader_length[] = { static_cast<int>(shader_source.length()) }; 89 int shader_length[] = { static_cast<int>(shader_source.length()) };
90 context->ShaderSource( 90 context->ShaderSource(
91 shader, 1, 91 shader, 1,
92 shader_source_str, 92 shader_source_str,
93 shader_length); 93 shader_length);
94 context->CompileShader(shader); 94 context->CompileShader(shader);
95 #if DCHECK_IS_ON() 95 #if DCHECK_IS_ON()
96 int compiled = 0; 96 int compiled = 0;
97 context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled); 97 context->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
98 if (!compiled) { 98 if (!compiled) {
99 char buffer[1024]; 99 char buffer[1024] = "";
100 context->GetShaderInfoLog(shader, sizeof(buffer), nullptr, buffer); 100 context->GetShaderInfoLog(shader, sizeof(buffer), nullptr, buffer);
101 DLOG(ERROR) << "Error compiling shader: " << buffer 101 DLOG(ERROR) << "Error compiling shader: " << buffer
102 << "\n shader program: " << shader_source; 102 << "\n shader program: " << shader_source;
103 return 0u; 103 return 0u;
104 } 104 }
105 #endif 105 #endif
106 return shader; 106 return shader;
107 } 107 }
108 108
109 unsigned ProgramBindingBase::CreateShaderProgram(GLES2Interface* context, 109 unsigned ProgramBindingBase::CreateShaderProgram(GLES2Interface* context,
(...skipping 27 matching lines...) Expand all
137 context->DeleteShader(fragment_shader_id_); 137 context->DeleteShader(fragment_shader_id_);
138 fragment_shader_id_ = 0; 138 fragment_shader_id_ = 0;
139 } 139 }
140 } 140 }
141 141
142 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { 142 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) {
143 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; 143 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR;
144 } 144 }
145 145
146 } // namespace cc 146 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698