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

Side by Side Diff: dm/DMSrcSink.cpp

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

Powered by Google App Engine
This is Rietveld 408576698