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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1448883002: Make NVPR a GL context option instead of a GL context (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-02-other-tests-refactor
Patch Set: 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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 Error NullSink::draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const { 782 Error NullSink::draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const {
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 GrGLStandard api, 792 GrGLStandard gpuAPI,
793 int samples, 793 int samples,
794 bool diText, 794 bool diText,
795 bool threaded) 795 bool threaded)
796 : fContextType(ct) 796 : fContextType(ct)
797 , fGpuAPI(api) 797 , fContextOptions(GrContextFactory::kNone_GLContextOptions)
798 , fGpuAPI(gpuAPI)
798 , fSampleCount(samples) 799 , fSampleCount(samples)
799 , fUseDIText(diText) 800 , fUseDIText(diText)
800 , fThreaded(threaded) {} 801 , fThreaded(threaded) {}
802
803 GPUSink::GPUSink(GrContextFactory::GLContextType ct,
804 GrContextFactory::GLContextOptions options,
805 GrGLStandard gpuAPI,
806 int samples,
807 bool diText,
808 bool threaded)
809 : fContextType(ct)
810 , fContextOptions(options)
811 , fGpuAPI(gpuAPI)
812 , fSampleCount(samples)
813 , fUseDIText(diText)
814 , fThreaded(threaded) {}
801 815
802 int GPUSink::enclave() const { 816 int GPUSink::enclave() const {
803 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; 817 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave;
804 } 818 }
805 819
806 void PreAbandonGpuContextErrorHandler(SkError, void*) {} 820 void PreAbandonGpuContextErrorHandler(SkError, void*) {}
807 821
808 DEFINE_bool(imm, false, "Run gpu configs in immediate mode."); 822 DEFINE_bool(imm, false, "Run gpu configs in immediate mode.");
809 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin g."); 823 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin g.");
810 824
811 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co nst { 825 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co nst {
812 GrContextOptions options; 826 GrContextOptions grOptions;
813 if (FLAGS_imm) { 827 if (FLAGS_imm) {
814 options.fImmediateMode = true; 828 grOptions.fImmediateMode = true;
815 } 829 }
816 if (FLAGS_batchClip) { 830 if (FLAGS_batchClip) {
817 options.fClipBatchToBounds = true; 831 grOptions.fClipBatchToBounds = true;
818 } 832 }
819 src.modifyGrContextOptions(&options); 833 src.modifyGrContextOptions(&grOptions);
820 834
821 GrContextFactory factory(options); 835 GrContextFactory factory(grOptions);
822 const SkISize size = src.size(); 836 const SkISize size = src.size();
823 const SkImageInfo info = 837 const SkImageInfo info =
824 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType); 838 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType);
825 SkAutoTUnref<SkSurface> surface( 839 SkAutoTUnref<SkSurface> surface(
826 NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, f UseDIText)); 840 NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info , fSampleCount, fUseDIText));
827 if (!surface) { 841 if (!surface) {
828 return "Could not create a surface."; 842 return "Could not create a surface.";
829 } 843 }
830 if (FLAGS_preAbandonGpuContext) { 844 if (FLAGS_preAbandonGpuContext) {
831 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); 845 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr);
832 factory.abandonContexts(); 846 factory.abandonContexts();
833 } 847 }
834 SkCanvas* canvas = surface->getCanvas(); 848 SkCanvas* canvas = surface->getCanvas();
835 Error err = src.draw(canvas); 849 Error err = src.draw(canvas);
836 if (!err.isEmpty()) { 850 if (!err.isEmpty()) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 skr.visit<void>(i, drawsAsSingletonPictures); 1274 skr.visit<void>(i, drawsAsSingletonPictures);
1261 } 1275 }
1262 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1276 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1263 1277
1264 canvas->drawPicture(macroPic); 1278 canvas->drawPicture(macroPic);
1265 return ""; 1279 return "";
1266 }); 1280 });
1267 } 1281 }
1268 1282
1269 } // namespace DM 1283 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | src/gpu/GrContextFactory.h » ('j') | src/gpu/GrContextFactory.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698