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

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: rebase 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 api, 792 GrContextFactory::GLContextOptions options,
793 GrGLStandard gpuAPI,
793 int samples, 794 int samples,
794 bool diText, 795 bool diText,
795 bool threaded) 796 bool threaded)
796 : fContextType(ct) 797 : fContextType(ct)
797 , fGpuAPI(api) 798 , fContextOptions(options)
799 , fGpuAPI(gpuAPI)
798 , fSampleCount(samples) 800 , fSampleCount(samples)
799 , fUseDIText(diText) 801 , fUseDIText(diText)
800 , fThreaded(threaded) {} 802 , fThreaded(threaded) {}
801 803
802 int GPUSink::enclave() const { 804 int GPUSink::enclave() const {
803 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave; 805 return fThreaded ? kAnyThread_Enclave : kGPU_Enclave;
804 } 806 }
805 807
806 void PreAbandonGpuContextErrorHandler(SkError, void*) {} 808 void PreAbandonGpuContextErrorHandler(SkError, void*) {}
807 809
808 DEFINE_bool(imm, false, "Run gpu configs in immediate mode."); 810 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."); 811 DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testin g.");
810 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch."); 812 DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch.");
811 813
812 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co nst { 814 Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co nst {
813 GrContextOptions options; 815 GrContextOptions grOptions;
814 if (FLAGS_imm) { 816 if (FLAGS_imm) {
815 options.fImmediateMode = true; 817 grOptions.fImmediateMode = true;
816 } 818 }
817 if (FLAGS_batchClip) { 819 if (FLAGS_batchClip) {
818 options.fClipBatchToBounds = true; 820 grOptions.fClipBatchToBounds = true;
819 } 821 }
822
820 if (FLAGS_batchBounds) { 823 if (FLAGS_batchBounds) {
821 options.fDrawBatchBounds = true; 824 grOptions.fDrawBatchBounds = true;
822 } 825 }
823 src.modifyGrContextOptions(&options); 826 src.modifyGrContextOptions(&grOptions);
824 827
825 GrContextFactory factory(options); 828 GrContextFactory factory(grOptions);
826 const SkISize size = src.size(); 829 const SkISize size = src.size();
827 const SkImageInfo info = 830 const SkImageInfo info =
828 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType); 831 SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType, kPremul _SkAlphaType);
829 SkAutoTUnref<SkSurface> surface( 832 SkAutoTUnref<SkSurface> surface(
830 NewGpuSurface(&factory, fContextType, fGpuAPI, info, fSampleCount, f UseDIText)); 833 NewGpuSurface(&factory, fContextType, fContextOptions, fGpuAPI, info , fSampleCount,
834 fUseDIText));
831 if (!surface) { 835 if (!surface) {
832 return "Could not create a surface."; 836 return "Could not create a surface.";
833 } 837 }
834 if (FLAGS_preAbandonGpuContext) { 838 if (FLAGS_preAbandonGpuContext) {
835 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr); 839 SkSetErrorCallback(&PreAbandonGpuContextErrorHandler, nullptr);
836 factory.abandonContexts(); 840 factory.abandonContexts();
837 } 841 }
838 SkCanvas* canvas = surface->getCanvas(); 842 SkCanvas* canvas = surface->getCanvas();
839 Error err = src.draw(canvas); 843 Error err = src.draw(canvas);
840 if (!err.isEmpty()) { 844 if (!err.isEmpty()) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 skr.visit<void>(i, drawsAsSingletonPictures); 1268 skr.visit<void>(i, drawsAsSingletonPictures);
1265 } 1269 }
1266 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1270 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1267 1271
1268 canvas->drawPicture(macroPic); 1272 canvas->drawPicture(macroPic);
1269 return ""; 1273 return "";
1270 }); 1274 });
1271 } 1275 }
1272 1276
1273 } // namespace DM 1277 } // 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