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

Side by Side Diff: bench/GLInstancedArraysBench.cpp

Issue 1379923005: Remove const from `const int loops`. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: n too Created 5 years, 2 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 | « bench/GLBench.cpp ('k') | bench/GLVec4ScalarBench.cpp » ('j') | 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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageEncoder.h" 10 #include "SkImageEncoder.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 fName = VboSetupToStr(vboSetup, fDrawDiv); 55 fName = VboSetupToStr(vboSetup, fDrawDiv);
56 } 56 }
57 57
58 protected: 58 protected:
59 const char* onGetName() override { 59 const char* onGetName() override {
60 return fName.c_str(); 60 return fName.c_str();
61 } 61 }
62 62
63 const GrGLContext* onGetGLContext(const GrGLContext*) override; 63 const GrGLContext* onGetGLContext(const GrGLContext*) override;
64 void setup(const GrGLContext*) override; 64 void setup(const GrGLContext*) override;
65 void glDraw(const int loops, const GrGLContext*) override; 65 void glDraw(int loops, const GrGLContext*) override;
66 void teardown(const GrGLInterface*) override; 66 void teardown(const GrGLInterface*) override;
67 67
68 private: 68 private:
69 void setupInstanceVbo(const GrGLInterface*, const SkMatrix*); 69 void setupInstanceVbo(const GrGLInterface*, const SkMatrix*);
70 void setupDoubleVbo(const GrGLInterface*, const SkMatrix*); 70 void setupDoubleVbo(const GrGLInterface*, const SkMatrix*);
71 void setupSingleVbo(const GrGLInterface*, const SkMatrix*); 71 void setupSingleVbo(const GrGLInterface*, const SkMatrix*);
72 GrGLuint setupShader(const GrGLContext*); 72 GrGLuint setupShader(const GrGLContext*);
73 73
74 static SkString VboSetupToStr(VboSetup vboSetup, uint32_t drawDiv) { 74 static SkString VboSetupToStr(VboSetup vboSetup, uint32_t drawDiv) {
75 SkString name("GLInstancedArraysBench"); 75 SkString name("GLInstancedArraysBench");
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 // clear screen 333 // clear screen
334 GR_GL_CALL(gl, ClearColor(0.03f, 0.03f, 0.03f, 1.0f)); 334 GR_GL_CALL(gl, ClearColor(0.03f, 0.03f, 0.03f, 1.0f));
335 GR_GL_CALL(gl, Clear(GR_GL_COLOR_BUFFER_BIT)); 335 GR_GL_CALL(gl, Clear(GR_GL_COLOR_BUFFER_BIT));
336 336
337 // set us up to draw 337 // set us up to draw
338 GR_GL_CALL(gl, UseProgram(fProgram)); 338 GR_GL_CALL(gl, UseProgram(fProgram));
339 GR_GL_CALL(gl, BindVertexArray(fVAO)); 339 GR_GL_CALL(gl, BindVertexArray(fVAO));
340 } 340 }
341 341
342 void GLCpuPosInstancedArraysBench::glDraw(const int loops, const GrGLContext* ct x) { 342 void GLCpuPosInstancedArraysBench::glDraw(int loops, const GrGLContext* ctx) {
343 const GrGLInterface* gl = ctx->interface(); 343 const GrGLInterface* gl = ctx->interface();
344 344
345 uint32_t maxTrianglesPerFlush = fDrawDiv == 0 ? kNumTri : 345 uint32_t maxTrianglesPerFlush = fDrawDiv == 0 ? kNumTri :
346 kDrawMultiplier / fDrawDiv; 346 kDrawMultiplier / fDrawDiv;
347 uint32_t trianglesToDraw = loops * kDrawMultiplier; 347 uint32_t trianglesToDraw = loops * kDrawMultiplier;
348 348
349 if (kUseInstance_VboSetup == fVboSetup) { 349 if (kUseInstance_VboSetup == fVboSetup) {
350 while (trianglesToDraw > 0) { 350 while (trianglesToDraw > 0) {
351 uint32_t triangles = SkTMin(trianglesToDraw, maxTrianglesPerFlush); 351 uint32_t triangles = SkTMin(trianglesToDraw, maxTrianglesPerFlush);
352 GR_GL_CALL(gl, DrawArraysInstanced(GR_GL_TRIANGLES, 0, kVerticesPerT ri, triangles)); 352 GR_GL_CALL(gl, DrawArraysInstanced(GR_GL_TRIANGLES, 0, kVerticesPerT ri, triangles));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 1) ) 388 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 1) )
389 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 1) ) 389 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 1) )
390 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 2) ) 390 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 2) )
391 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 2) ) 391 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 2) )
392 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 4) ) 392 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 4) )
393 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 4) ) 393 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 4) )
394 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 8) ) 394 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseOne_VboSetup, 8) )
395 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 8) ) 395 DEF_BENCH( return new GLCpuPosInstancedArraysBench(GLCpuPosInstancedArraysBench: :kUseTwo_VboSetup, 8) )
396 396
397 #endif 397 #endif
OLDNEW
« no previous file with comments | « bench/GLBench.cpp ('k') | bench/GLVec4ScalarBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698