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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 304743004: Move ETC1 and LATC enums value to GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove some duplicated flags in (GL)DrawTargetCaps Created 6 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index b35865c2641509907f241a71098cf8a293a5b4b8..fafac9daddd15b6e781f742990a691e97d78841a 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1007,7 +1007,6 @@ void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* d
///////////////////////////////////////////////////////////////////////////////
void GrDrawTargetCaps::reset() {
- f8BitPaletteSupport = false;
fMipMapSupport = false;
fNPOTTextureTileSupport = false;
fTwoSidedStencilSupport = false;
@@ -1029,11 +1028,10 @@ void GrDrawTargetCaps::reset() {
fMaxSampleCount = 0;
memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport));
- memset(fCompressedFormatSupport, 0, sizeof(fCompressedFormatSupport));
+ memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport));
}
GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
- f8BitPaletteSupport = other.f8BitPaletteSupport;
fMipMapSupport = other.fMipMapSupport;
fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
@@ -1055,8 +1053,7 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
fMaxSampleCount = other.fMaxSampleCount;
memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRenderSupport));
- memcpy(fCompressedFormatSupport, other.fCompressedFormatSupport,
- sizeof(fCompressedFormatSupport));
+ memcpy(fConfigTextureSupport, other.fConfigTextureSupport, sizeof(fConfigTextureSupport));
return *this;
}
@@ -1084,7 +1081,6 @@ static SkString map_flags_to_string(uint32_t flags) {
SkString GrDrawTargetCaps::dump() const {
SkString r;
static const char* gNY[] = {"NO", "YES"};
- r.appendf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]);
r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
@@ -1112,6 +1108,8 @@ SkString GrDrawTargetCaps::dump() const {
"RGBA444", // kRGBA_4444_GrPixelConfig,
"RGBA8888", // kRGBA_8888_GrPixelConfig,
"BGRA8888", // kBGRA_8888_GrPixelConfig,
+ "ETC1", // kETC1_GrPixelConfig,
+ "LATC", // kLATC_GrPixelConfig,
};
GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig);
GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig);
@@ -1120,10 +1118,13 @@ SkString GrDrawTargetCaps::dump() const {
GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig);
+ GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt);
SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][0]);
SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][1]);
+
for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
if (i != kUnknown_GrPixelConfig) {
r.appendf("%s is renderable: %s, with MSAA: %s\n",
@@ -1133,20 +1134,14 @@ SkString GrDrawTargetCaps::dump() const {
}
}
- static const char* kCompressedFormatNames[] = {
- "ETC1", // kETC1_GrCompressedFormat
- "ETC2", // kETC2_GrCompressedFormat,
- "DXT1", // kDXT1_GrCompressedFormat,
- };
- GR_STATIC_ASSERT(0 == kETC1_GrCompressedFormat);
- GR_STATIC_ASSERT(1 == kETC2_GrCompressedFormat);
- GR_STATIC_ASSERT(2 == kDXT1_GrCompressedFormat);
- GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCompressedFormatNames) == kGrCompressedFormatCount);
-
- for (size_t i = 0; i < SK_ARRAY_COUNT(kCompressedFormatNames); ++i) {
- r.appendf("%s Compressed Texture Support: %s\n",
- kCompressedFormatNames[i],
- gNY[fCompressedFormatSupport[i]]);
+ SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]);
+
robertphillips 2014/05/29 20:08:43 Can we just start the loop at 1 ?
krajcevski 2014/05/29 20:31:28 Done.
+ for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
+ if (i != kUnknown_GrPixelConfig) {
+ r.appendf("%s is uploadable to a texture: %s\n",
+ kConfigNames[i],
+ gNY[fConfigTextureSupport[i]]);
+ }
}
return r;

Powered by Google App Engine
This is Rietveld 408576698