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

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: Add missing spaces 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 // The driver will ignore a clear if it is the only thing rendered to a
554 // target before the target is read.
555 SkIRect rtRect = SkIRect::MakeWH(renderTarget->width(), renderTarget->he ight());
556 if (NULL == rect || canIgnoreRect || rect->contains(rtRect)) {
557 rect = &rtRect;
558 // We first issue a discard() since that may help tilers.
559 this->discard(renderTarget);
560 }
561 AutoStateRestore asr(this, kReset_ASRInit, &SkMatrix::I());
562
563 this->drawState()->setColor(color);
564 this->drawState()->disableState(GrDrawState::kClip_StateBit);
565 this->drawState()->disableState(GrDrawState::kHWAntialias_StateBit);
566 this->drawState()->setRenderTarget(renderTarget);
567
568 this->drawSimpleRect(*rect);
569 } else {
570 this->onClear(rect, color, canIgnoreRect, renderTarget);
571 }
572 }
573
549 typedef GrTraceMarkerSet::Iter TMIter; 574 typedef GrTraceMarkerSet::Iter TMIter;
550 void GrDrawTarget::saveActiveTraceMarkers() { 575 void GrDrawTarget::saveActiveTraceMarkers() {
551 if (this->caps()->gpuTracingSupport()) { 576 if (this->caps()->gpuTracingSupport()) {
552 SkASSERT(0 == fStoredTraceMarkers.count()); 577 SkASSERT(0 == fStoredTraceMarkers.count());
553 fStoredTraceMarkers.addSet(fActiveTraceMarkers); 578 fStoredTraceMarkers.addSet(fActiveTraceMarkers);
554 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) { 579 for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMark ers.end(); ++iter) {
555 this->removeGpuTraceMarker(&(*iter)); 580 this->removeGpuTraceMarker(&(*iter));
556 } 581 }
557 } 582 }
558 } 583 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 fShaderDerivativeSupport = false; 987 fShaderDerivativeSupport = false;
963 fGeometryShaderSupport = false; 988 fGeometryShaderSupport = false;
964 fDualSourceBlendingSupport = false; 989 fDualSourceBlendingSupport = false;
965 fPathRenderingSupport = false; 990 fPathRenderingSupport = false;
966 fDstReadInShaderSupport = false; 991 fDstReadInShaderSupport = false;
967 fDiscardRenderTargetSupport = false; 992 fDiscardRenderTargetSupport = false;
968 fReuseScratchTextures = true; 993 fReuseScratchTextures = true;
969 fGpuTracingSupport = false; 994 fGpuTracingSupport = false;
970 fCompressedTexSubImageSupport = false; 995 fCompressedTexSubImageSupport = false;
971 996
997 fUseDrawInsteadOfClear = false;
998
972 fMapBufferFlags = kNone_MapFlags; 999 fMapBufferFlags = kNone_MapFlags;
973 1000
974 fMaxRenderTargetSize = 0; 1001 fMaxRenderTargetSize = 0;
975 fMaxTextureSize = 0; 1002 fMaxTextureSize = 0;
976 fMaxSampleCount = 0; 1003 fMaxSampleCount = 0;
977 1004
978 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); 1005 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport));
979 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); 1006 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport));
980 } 1007 }
981 1008
982 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { 1009 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
983 fMipMapSupport = other.fMipMapSupport; 1010 fMipMapSupport = other.fMipMapSupport;
984 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport; 1011 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
985 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport; 1012 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
986 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport; 1013 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport;
987 fHWAALineSupport = other.fHWAALineSupport; 1014 fHWAALineSupport = other.fHWAALineSupport;
988 fShaderDerivativeSupport = other.fShaderDerivativeSupport; 1015 fShaderDerivativeSupport = other.fShaderDerivativeSupport;
989 fGeometryShaderSupport = other.fGeometryShaderSupport; 1016 fGeometryShaderSupport = other.fGeometryShaderSupport;
990 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport; 1017 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport;
991 fPathRenderingSupport = other.fPathRenderingSupport; 1018 fPathRenderingSupport = other.fPathRenderingSupport;
992 fDstReadInShaderSupport = other.fDstReadInShaderSupport; 1019 fDstReadInShaderSupport = other.fDstReadInShaderSupport;
993 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport; 1020 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport;
994 fReuseScratchTextures = other.fReuseScratchTextures; 1021 fReuseScratchTextures = other.fReuseScratchTextures;
995 fGpuTracingSupport = other.fGpuTracingSupport; 1022 fGpuTracingSupport = other.fGpuTracingSupport;
996 fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport; 1023 fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport;
997 1024
1025 fUseDrawInsteadOfClear = other.fUseDrawInsteadOfClear;
1026
998 fMapBufferFlags = other.fMapBufferFlags; 1027 fMapBufferFlags = other.fMapBufferFlags;
999 1028
1000 fMaxRenderTargetSize = other.fMaxRenderTargetSize; 1029 fMaxRenderTargetSize = other.fMaxRenderTargetSize;
1001 fMaxTextureSize = other.fMaxTextureSize; 1030 fMaxTextureSize = other.fMaxTextureSize;
1002 fMaxSampleCount = other.fMaxSampleCount; 1031 fMaxSampleCount = other.fMaxSampleCount;
1003 1032
1004 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende rSupport)); 1033 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende rSupport));
1005 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex tureSupport)); 1034 memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTex tureSupport));
1006 1035
1007 return *this; 1036 return *this;
(...skipping 15 matching lines...) Expand all
1023 } 1052 }
1024 SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag); 1053 SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag);
1025 } 1054 }
1026 SkASSERT(0 == flags); // Make sure we handled all the flags. 1055 SkASSERT(0 == flags); // Make sure we handled all the flags.
1027 return str; 1056 return str;
1028 } 1057 }
1029 1058
1030 SkString GrDrawTargetCaps::dump() const { 1059 SkString GrDrawTargetCaps::dump() const {
1031 SkString r; 1060 SkString r;
1032 static const char* gNY[] = {"NO", "YES"}; 1061 static const char* gNY[] = {"NO", "YES"};
1033 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); 1062 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
1034 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport ]); 1063 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileS upport]);
1035 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport ]); 1064 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilS upport]);
1036 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport] ); 1065 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSu pport]);
1037 r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); 1066 r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport] );
1038 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSuppor t]); 1067 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivative Support]);
1039 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport] ); 1068 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSu pport]);
1040 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupp ort]); 1069 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendi ngSupport]);
1041 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]) ; 1070 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSup port]);
1042 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport ]); 1071 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderS upport]);
1043 r.appendf("Discard Render Target Support: %s\n", gNY[fDiscardRenderTargetSup port]); 1072 r.appendf("Discard Render Target Support : %s\n", gNY[fDiscardRenderTar getSupport]);
1044 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]) ; 1073 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchText ures]);
1045 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSupport]); 1074 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSuppor t]);
1046 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSubImageS upport]); 1075 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 1076
1051 r.appendf("Map Buffer Support : %s\n", map_flags_to_string(fMapBuf ferFlags).c_str()); 1077 r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOf Clear]);
1078
1079 r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
1080 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize) ;
1081 r.appendf("Max Sample Count : %d\n", fMaxSampleCount);
1082
1083 r.appendf("Map Buffer Support : %s\n",
1084 map_flags_to_string(fMapBufferFlags).c_str());
1052 1085
1053 static const char* kConfigNames[] = { 1086 static const char* kConfigNames[] = {
1054 "Unknown", // kUnknown_GrPixelConfig 1087 "Unknown", // kUnknown_GrPixelConfig
1055 "Alpha8", // kAlpha_8_GrPixelConfig, 1088 "Alpha8", // kAlpha_8_GrPixelConfig,
1056 "Index8", // kIndex_8_GrPixelConfig, 1089 "Index8", // kIndex_8_GrPixelConfig,
1057 "RGB565", // kRGB_565_GrPixelConfig, 1090 "RGB565", // kRGB_565_GrPixelConfig,
1058 "RGBA444", // kRGBA_4444_GrPixelConfig, 1091 "RGBA444", // kRGBA_4444_GrPixelConfig,
1059 "RGBA8888", // kRGBA_8888_GrPixelConfig, 1092 "RGBA8888", // kRGBA_8888_GrPixelConfig,
1060 "BGRA8888", // kBGRA_8888_GrPixelConfig, 1093 "BGRA8888", // kBGRA_8888_GrPixelConfig,
1061 "ETC1", // kETC1_GrPixelConfig, 1094 "ETC1", // kETC1_GrPixelConfig,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1134
1102 uint32_t GrDrawTargetCaps::CreateUniqueID() { 1135 uint32_t GrDrawTargetCaps::CreateUniqueID() {
1103 static int32_t gUniqueID = SK_InvalidUniqueID; 1136 static int32_t gUniqueID = SK_InvalidUniqueID;
1104 uint32_t id; 1137 uint32_t id;
1105 do { 1138 do {
1106 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 1139 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
1107 } while (id == SK_InvalidUniqueID); 1140 } while (id == SK_InvalidUniqueID);
1108 return id; 1141 return id;
1109 } 1142 }
1110 1143
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawTargetCaps.h » ('j') | src/gpu/gl/GrGLUtil.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698