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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: fix errorneous config handling Created 5 years 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
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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SamplePipeControllers.h" 9 #include "SamplePipeControllers.h"
10 #include "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 SkAutoTDelete<SkCanvas> canvas(SkCreateNullCanvas()); 783 SkAutoTDelete<SkCanvas> canvas(SkCreateNullCanvas());
784 return src.draw(canvas); 784 return src.draw(canvas);
785 } 785 }
786 786
787 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 787 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
788 788
789 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?"); 789 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?");
790 790
791 GPUSink::GPUSink(GrContextFactory::GLContextType ct, 791 GPUSink::GPUSink(GrContextFactory::GLContextType ct,
792 GrContextFactory::GLContextOptions options, 792 GrContextFactory::GLContextOptions options,
793 GrGLStandard gpuAPI,
794 int samples, 793 int samples,
795 bool diText, 794 bool diText,
796 bool threaded) 795 bool threaded)
797 : fContextType(ct) 796 : fContextType(ct)
798 , fContextOptions(options) 797 , fContextOptions(options)
799 , fGpuAPI(gpuAPI)
800 , fSampleCount(samples) 798 , fSampleCount(samples)
801 , fUseDIText(diText) 799 , fUseDIText(diText)
802 , fThreaded(threaded) {} 800 , fThreaded(threaded) {}
803 801
804 int GPUSink::enclave() const { 802 int GPUSink::enclave() const {
805 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; 803 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave;
806 } 804 }
807 805
808 void PreAbandonGpuContextErrorHandler(SkError, void*) {} 806 void PreAbandonGpuContextErrorHandler(SkError, void*) {}
809 807
(...skipping 13 matching lines...) Expand all
823 if (FLAGS_batchBounds) { 821 if (FLAGS_batchBounds) {
824 grOptions.fDrawBatchBounds = true; 822 grOptions.fDrawBatchBounds = true;
825 } 823 }
826 src.modifyGrContextOptions(&grOptions); 824 src.modifyGrContextOptions(&grOptions);
827 825
828 GrContextFactory factory(grOptions); 826 GrContextFactory factory(grOptions);
829 const SkISize size = src.size(); 827 const SkISize size = src.size();
830 const SkImageInfo info = 828 const SkImageInfo info =
831 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType); 829 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType);
832 SkAutoTUnref<SkSurface> surface( 830 SkAutoTUnref<SkSurface> surface(
833 NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info , fSampleCount, 831 NewGpuSurface(&factory, fContextType, fContextOptions, info, fSample Count, fUseDIText));
834 fUseDIText));
835 if (!surface) { 832 if (!surface) {
836 return "Could not create a surface."; 833 return "Could not create a surface.";
837 } 834 }
838 if (FLAGS_preAbandonGpuContext) { 835 if (FLAGS_preAbandonGpuContext) {
839 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); 836 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr);
840 factory.abandonContexts(); 837 factory.abandonContexts();
841 } 838 }
842 SkCanvas* canvas = surface->getCanvas(); 839 SkCanvas* canvas = surface->getCanvas();
843 Error err = src.draw(canvas); 840 Error err = src.draw(canvas);
844 if (!err.isEmpty()) { 841 if (!err.isEmpty()) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 skr.visit<void>(i, drawsAsSingletonPictures); 1265 skr.visit<void>(i, drawsAsSingletonPictures);
1269 } 1266 }
1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1267 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1271 1268
1272 canvas->drawPicture(macroPic); 1269 canvas->drawPicture(macroPic);
1273 return ""; 1270 return "";
1274 }); 1271 });
1275 } 1272 }
1276 1273
1277 } // namespace DM 1274 } // namespace DM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698