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

Side by Side Diff: bench/GLBench.cpp

Issue 1318143004: skia: Initialize value passed to GetShaderiv in GLBench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove code that leaked in Created 5 years, 3 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 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GLBench.h" 8 #include "GLBench.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Create the shader object 63 // Create the shader object
64 GR_GL_CALL_RET(gl, shader, CreateShader(type)); 64 GR_GL_CALL_RET(gl, shader, CreateShader(type));
65 65
66 // Load the shader source 66 // Load the shader source
67 GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr)); 67 GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr));
68 68
69 // Compile the shader 69 // Compile the shader
70 GR_GL_CALL(gl, CompileShader(shader)); 70 GR_GL_CALL(gl, CompileShader(shader));
71 71
72 // Check for compile time errors 72 // Check for compile time errors
73 GrGLint success; 73 GrGLint success = GR_GL_INIT_ZERO;
74 GrGLchar infoLog[512]; 74 GrGLchar infoLog[512];
75 GR_GL_CALL(gl, GetShaderiv(shader, GR_GL_COMPILE_STATUS, &success)); 75 GR_GL_CALL(gl, GetShaderiv(shader, GR_GL_COMPILE_STATUS, &success));
76 if (!success) { 76 if (!success) {
77 GR_GL_CALL(gl, GetShaderInfoLog(shader, 512, nullptr, infoLog)); 77 GR_GL_CALL(gl, GetShaderInfoLog(shader, 512, nullptr, infoLog));
78 SkDebugf("ERROR::SHADER::COMPLIATION_FAILED: %s\n", infoLog); 78 SkDebugf("ERROR::SHADER::COMPLIATION_FAILED: %s\n", infoLog);
79 } 79 }
80 80
81 return shader; 81 return shader;
82 } 82 }
83 83
84 GrGLuint GLBench::CreateProgram(const GrGLInterface* gl, const char* vshader, co nst char* fshader) { 84 GrGLuint GLBench::CreateProgram(const GrGLInterface* gl, const char* vshader, co nst char* fshader) {
85 85
86 GrGLuint vertexShader = CompileShader(gl, vshader, GR_GL_VERTEX_SHADER); 86 GrGLuint vertexShader = CompileShader(gl, vshader, GR_GL_VERTEX_SHADER);
87 GrGLuint fragmentShader = CompileShader(gl, fshader, GR_GL_FRAGMENT_SHADER); 87 GrGLuint fragmentShader = CompileShader(gl, fshader, GR_GL_FRAGMENT_SHADER);
88 88
89 GrGLuint shaderProgram; 89 GrGLuint shaderProgram;
90 GR_GL_CALL_RET(gl, shaderProgram, CreateProgram()); 90 GR_GL_CALL_RET(gl, shaderProgram, CreateProgram());
91 GR_GL_CALL(gl, AttachShader(shaderProgram, vertexShader)); 91 GR_GL_CALL(gl, AttachShader(shaderProgram, vertexShader));
92 GR_GL_CALL(gl, AttachShader(shaderProgram, fragmentShader)); 92 GR_GL_CALL(gl, AttachShader(shaderProgram, fragmentShader));
93 GR_GL_CALL(gl, LinkProgram(shaderProgram)); 93 GR_GL_CALL(gl, LinkProgram(shaderProgram));
94 94
95 // Check for linking errors 95 // Check for linking errors
96 GrGLint success; 96 GrGLint success = GR_GL_INIT_ZERO;
97 GrGLchar infoLog[512]; 97 GrGLchar infoLog[512];
98 GR_GL_CALL(gl, GetProgramiv(shaderProgram, GR_GL_LINK_STATUS, &success)); 98 GR_GL_CALL(gl, GetProgramiv(shaderProgram, GR_GL_LINK_STATUS, &success));
99 if (!success) { 99 if (!success) {
100 GR_GL_CALL(gl, GetProgramInfoLog(shaderProgram, 512, nullptr, infoLog)); 100 GR_GL_CALL(gl, GetProgramInfoLog(shaderProgram, 512, nullptr, infoLog));
101 SkDebugf("Linker Error: %s\n", infoLog); 101 SkDebugf("Linker Error: %s\n", infoLog);
102 } 102 }
103 GR_GL_CALL(gl, DeleteShader(vertexShader)); 103 GR_GL_CALL(gl, DeleteShader(vertexShader));
104 GR_GL_CALL(gl, DeleteShader(fragmentShader)); 104 GR_GL_CALL(gl, DeleteShader(fragmentShader));
105 105
106 return shaderProgram; 106 return shaderProgram;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bm.setPixels(readback.get()); 163 bm.setPixels(readback.get());
164 164
165 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) { 165 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) {
166 SkDebugf("------ failed to encode %s\n", filename); 166 SkDebugf("------ failed to encode %s\n", filename);
167 remove(filename); // remove any partial file 167 remove(filename); // remove any partial file
168 return; 168 return;
169 } 169 }
170 } 170 }
171 171
172 #endif 172 #endif
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