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

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 701573002: Workaround for PowerVR clear issue. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_null
Patch Set: fix discard, whitespace Created 6 years, 1 month 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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // support NV_blend_equation_advanced. 539 // support NV_blend_equation_advanced.
540 GrDeviceCoordTexture dstCopy; 540 GrDeviceCoordTexture dstCopy;
541 if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) { 541 if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) {
542 return; 542 return;
543 } 543 }
544 544
545 this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fil l, 545 this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fil l,
546 dstCopy.texture() ? &dstCopy : NULL); 546 dstCopy.texture() ? &dstCopy : NULL);
547 } 547 }
548 548
549 void GrDrawTarget::clear(const SkIRect* rect, GrColor color, bool canIgnoreRect,
550 GrRenderTarget* renderTarget) {
551 if (fCaps->useDrawInsteadOfClear()) {
552 // This works around a driver bug with clear by drawing a rect instead.
553 SkIRect tmpRect;
554 if (NULL == rect || canIgnoreRect) {
555 tmpRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->heigh t());
556 rect = &tmpRect;
557 // We first issue a discard() since that may help tilers.
558 this->discard(renderTarget);
559 }
robertphillips 2014/11/05 14:22:59 // We cannot just set canIgnoreRect to false and f
bsalomon 2014/11/05 14:56:47 Combined this with the comment above (right after
560 AutoStateRestore asr(this, kReset_ASRInit, &SkMatrix::I());
561
562 this->drawState()->setColor(color);
563 this->drawState()->disableState(GrDrawState::kClip_StateBit);
564 this->drawState()->disableState(GrDrawState::kHWAntialias_StateBit);
565 this->drawState()->setRenderTarget(renderTarget);
566
567 this->drawSimpleRect(*rect);
568 } else {
569 this->onClear(rect, color, canIgnoreRect, renderTarget);
570 }
571 }
572
549 typedef GrTraceMarkerSet::Iter TMIter; 573 typedef GrTraceMarkerSet::Iter TMIter;
550 void GrDrawTarget::saveActiveTraceMarkers() { 574 void GrDrawTarget::saveActiveTraceMarkers() {
551 if (this->caps()->gpuTracingSupport()) { 575 if (this->caps()->gpuTracingSupport()) {
552 SkASSERT(0 == fStoredTraceMarkers.count()); 576 SkASSERT(0 == fStoredTraceMarkers.count());
553 fStoredTraceMarkers.addSet(fActiveTraceMarkers); 577 fStoredTraceMarkers.addSet(fActiveTraceMarkers);
554 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) { 578 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) {
555 this->removeGpuTraceMarker(&(*iter)); 579 this->removeGpuTraceMarker(&(*iter));
556 } 580 }
557 } 581 }
558 } 582 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 fShaderDerivativeSupport = false; 986 fShaderDerivativeSupport = false;
963 fGeometryShaderSupport = false; 987 fGeometryShaderSupport = false;
964 fDualSourceBlendingSupport = false; 988 fDualSourceBlendingSupport = false;
965 fPathRenderingSupport = false; 989 fPathRenderingSupport = false;
966 fDstReadInShaderSupport = false; 990 fDstReadInShaderSupport = false;
967 fDiscardRenderTargetSupport = false; 991 fDiscardRenderTargetSupport = false;
968 fReuseScratchTextures = true; 992 fReuseScratchTextures = true;
969 fGpuTracingSupport = false; 993 fGpuTracingSupport = false;
970 fCompressedTexSubImageSupport = false; 994 fCompressedTexSubImageSupport = false;
971 995
996 fUseDrawInsteadOfClear = false;
997
972 fMapBufferFlags = kNone_MapFlags; 998 fMapBufferFlags = kNone_MapFlags;
973 999
974 fMaxRenderTargetSize = 0; 1000 fMaxRenderTargetSize = 0;
975 fMaxTextureSize = 0; 1001 fMaxTextureSize = 0;
976 fMaxSampleCount = 0; 1002 fMaxSampleCount = 0;
977 1003
978 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); 1004 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport));
979 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); 1005 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport));
980 } 1006 }
981 1007
982 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { 1008 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
983 fMipMapSupport = other.fMipMapSupport; 1009 fMipMapSupport = other.fMipMapSupport;
984 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport; 1010 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
985 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport; 1011 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
986 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport; 1012 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport;
987 fHWAALineSupport = other.fHWAALineSupport; 1013 fHWAALineSupport = other.fHWAALineSupport;
988 fShaderDerivativeSupport = other.fShaderDerivativeSupport; 1014 fShaderDerivativeSupport = other.fShaderDerivativeSupport;
989 fGeometryShaderSupport = other.fGeometryShaderSupport; 1015 fGeometryShaderSupport = other.fGeometryShaderSupport;
990 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport; 1016 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport;
991 fPathRenderingSupport = other.fPathRenderingSupport; 1017 fPathRenderingSupport = other.fPathRenderingSupport;
992 fDstReadInShaderSupport = other.fDstReadInShaderSupport; 1018 fDstReadInShaderSupport = other.fDstReadInShaderSupport;
993 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport; 1019 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport;
994 fReuseScratchTextures = other.fReuseScratchTextures; 1020 fReuseScratchTextures = other.fReuseScratchTextures;
995 fGpuTracingSupport = other.fGpuTracingSupport; 1021 fGpuTracingSupport = other.fGpuTracingSupport;
996 fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport; 1022 fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport;
997 1023
1024 fUseDrawInsteadOfClear = other.fUseDrawInsteadOfClear;
1025
998 fMapBufferFlags = other.fMapBufferFlags; 1026 fMapBufferFlags = other.fMapBufferFlags;
999 1027
1000 fMaxRenderTargetSize = other.fMaxRenderTargetSize; 1028 fMaxRenderTargetSize = other.fMaxRenderTargetSize;
1001 fMaxTextureSize = other.fMaxTextureSize; 1029 fMaxTextureSize = other.fMaxTextureSize;
1002 fMaxSampleCount = other.fMaxSampleCount; 1030 fMaxSampleCount = other.fMaxSampleCount;
1003 1031
1004 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende rSupport)); 1032 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende rSupport));
1005 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex tureSupport)); 1033 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex tureSupport));
1006 1034
1007 return *this; 1035 return *this;
(...skipping 15 matching lines...) Expand all
1023 } 1051 }
1024 SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag); 1052 SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag);
1025 } 1053 }
1026 SkASSERT(0 == flags); // Make sure we handled all the flags. 1054 SkASSERT(0 == flags); // Make sure we handled all the flags.
1027 return str; 1055 return str;
1028 } 1056 }
1029 1057
1030 SkString GrDrawTargetCaps::dump() const { 1058 SkString GrDrawTargetCaps::dump() const {
1031 SkString r; 1059 SkString r;
1032 static const char* gNY[] = {"NO", "YES"}; 1060 static const char* gNY[] = {"NO", "YES"};
1033 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); 1061 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
1034 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport ]); 1062 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileS upport]);
1035 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport ]); 1063 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilS upport]);
1036 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport] ); 1064 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSu pport]);
1037 r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); 1065 r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport] );
1038 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSuppor t]); 1066 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivative Support]);
1039 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport] ); 1067 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSu pport]);
1040 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupp ort]); 1068 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendi ngSupport]);
1041 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]) ; 1069 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSup port]);
1042 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport ]); 1070 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderS upport]);
1043 r.appendf("Discard Render Target Support: %s\n", gNY[fDiscardRenderTargetSup port]); 1071 r.appendf("Discard Render Target Support : %s\n", gNY[fDiscardRenderTar getSupport]);
1044 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]) ; 1072 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchText ures]);
1045 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSupport]); 1073 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSuppor t]);
1046 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSubImageS upport]); 1074 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSub ImageSupport]);
1047 r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
1048 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
1049 r.appendf("Max Sample Count : %d\n", fMaxSampleCount);
1050 1075
1051 r.appendf("Map Buffer Support : %s\n", map_flags_to_string(fMapBuf ferFlags).c_str()); 1076 r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOf Clear]);
1077
1078 r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
1079 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize) ;
1080 r.appendf("Max Sample Count : %d\n", fMaxSampleCount);
1081
1082 r.appendf("Map Buffer Support : %s\n",
1083 map_flags_to_string(fMapBufferFlags).c_str());
1052 1084
1053 static const char* kConfigNames[] = { 1085 static const char* kConfigNames[] = {
1054 "Unknown", // kUnknown_GrPixelConfig 1086 "Unknown", // kUnknown_GrPixelConfig
1055 "Alpha8", // kAlpha_8_GrPixelConfig, 1087 "Alpha8", // kAlpha_8_GrPixelConfig,
1056 "Index8", // kIndex_8_GrPixelConfig, 1088 "Index8", // kIndex_8_GrPixelConfig,
1057 "RGB565", // kRGB_565_GrPixelConfig, 1089 "RGB565", // kRGB_565_GrPixelConfig,
1058 "RGBA444", // kRGBA_4444_GrPixelConfig, 1090 "RGBA444", // kRGBA_4444_GrPixelConfig,
1059 "RGBA8888", // kRGBA_8888_GrPixelConfig, 1091 "RGBA8888", // kRGBA_8888_GrPixelConfig,
1060 "BGRA8888", // kBGRA_8888_GrPixelConfig, 1092 "BGRA8888", // kBGRA_8888_GrPixelConfig,
1061 "ETC1", // kETC1_GrPixelConfig, 1093 "ETC1", // kETC1_GrPixelConfig,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1133
1102 uint32_t GrDrawTargetCaps::CreateUniqueID() { 1134 uint32_t GrDrawTargetCaps::CreateUniqueID() {
1103 static int32_t gUniqueID = SK_InvalidUniqueID; 1135 static int32_t gUniqueID = SK_InvalidUniqueID;
1104 uint32_t id; 1136 uint32_t id;
1105 do { 1137 do {
1106 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 1138 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
1107 } while (id == SK_InvalidUniqueID); 1139 } while (id == SK_InvalidUniqueID);
1108 return id; 1140 return id;
1109 } 1141 }
1110 1142
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698