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

Side by Side Diff: bench/GLBench.cpp

Issue 1969623003: Reset context after doing non-Skia GL rendering. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 this->teardown(ctx->interface()); 50 this->teardown(ctx->interface());
51 } 51 }
52 52
53 void GLBench::onDraw(int loops, SkCanvas* canvas) { 53 void GLBench::onDraw(int loops, SkCanvas* canvas) {
54 const GrGLContext* ctx = this->getGLContext(canvas); 54 const GrGLContext* ctx = this->getGLContext(canvas);
55 if (!ctx) { 55 if (!ctx) {
56 return; 56 return;
57 } 57 }
58 this->glDraw(loops, ctx); 58 this->glDraw(loops, ctx);
59 canvas->getGrContext()->resetContext();
59 } 60 }
60 61
61 GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc, GrGLenum type) { 62 GrGLuint GLBench::CompileShader(const GrGLInterface* gl, const char* shaderSrc, GrGLenum type) {
62 GrGLuint shader; 63 GrGLuint shader;
63 // Create the shader object 64 // Create the shader object
64 GR_GL_CALL_RET(gl, shader, CreateShader(type)); 65 GR_GL_CALL_RET(gl, shader, CreateShader(type));
65 66
66 // Load the shader source 67 // Load the shader source
67 GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr)); 68 GR_GL_CALL(gl, ShaderSource(shader, 1, &shaderSrc, nullptr));
68 69
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 bm.setPixels(readback.get()); 164 bm.setPixels(readback.get());
164 165
165 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) { 166 if (!SkImageEncoder::EncodeFile(filename, bm, SkImageEncoder::kPNG_Type, 100 )) {
166 SkDebugf("------ failed to encode %s\n", filename); 167 SkDebugf("------ failed to encode %s\n", filename);
167 remove(filename); // remove any partial file 168 remove(filename); // remove any partial file
168 return; 169 return;
169 } 170 }
170 } 171 }
171 172
172 #endif 173 #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