OLD | NEW |
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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 void GrDrawTargetCaps::reset() { | 1009 void GrDrawTargetCaps::reset() { |
1010 f8BitPaletteSupport = false; | 1010 f8BitPaletteSupport = false; |
1011 fMipMapSupport = false; | 1011 fMipMapSupport = false; |
1012 fNPOTTextureTileSupport = false; | 1012 fNPOTTextureTileSupport = false; |
1013 fTwoSidedStencilSupport = false; | 1013 fTwoSidedStencilSupport = false; |
1014 fStencilWrapOpsSupport = false; | 1014 fStencilWrapOpsSupport = false; |
1015 fHWAALineSupport = false; | 1015 fHWAALineSupport = false; |
1016 fShaderDerivativeSupport = false; | 1016 fShaderDerivativeSupport = false; |
1017 fGeometryShaderSupport = false; | 1017 fGeometryShaderSupport = false; |
1018 fDualSourceBlendingSupport = false; | 1018 fDualSourceBlendingSupport = false; |
1019 fBufferLockSupport = false; | |
1020 fPathRenderingSupport = false; | 1019 fPathRenderingSupport = false; |
1021 fDstReadInShaderSupport = false; | 1020 fDstReadInShaderSupport = false; |
1022 fDiscardRenderTargetSupport = false; | 1021 fDiscardRenderTargetSupport = false; |
1023 fReuseScratchTextures = true; | 1022 fReuseScratchTextures = true; |
1024 fGpuTracingSupport = false; | 1023 fGpuTracingSupport = false; |
1025 | 1024 |
| 1025 fMapBufferFlags = kNone_MapFlags; |
| 1026 |
1026 fMaxRenderTargetSize = 0; | 1027 fMaxRenderTargetSize = 0; |
1027 fMaxTextureSize = 0; | 1028 fMaxTextureSize = 0; |
1028 fMaxSampleCount = 0; | 1029 fMaxSampleCount = 0; |
1029 | 1030 |
1030 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); | 1031 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); |
1031 } | 1032 } |
1032 | 1033 |
1033 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { | 1034 GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { |
1034 f8BitPaletteSupport = other.f8BitPaletteSupport; | 1035 f8BitPaletteSupport = other.f8BitPaletteSupport; |
1035 fMipMapSupport = other.fMipMapSupport; | 1036 fMipMapSupport = other.fMipMapSupport; |
1036 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport; | 1037 fNPOTTextureTileSupport = other.fNPOTTextureTileSupport; |
1037 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport; | 1038 fTwoSidedStencilSupport = other.fTwoSidedStencilSupport; |
1038 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport; | 1039 fStencilWrapOpsSupport = other.fStencilWrapOpsSupport; |
1039 fHWAALineSupport = other.fHWAALineSupport; | 1040 fHWAALineSupport = other.fHWAALineSupport; |
1040 fShaderDerivativeSupport = other.fShaderDerivativeSupport; | 1041 fShaderDerivativeSupport = other.fShaderDerivativeSupport; |
1041 fGeometryShaderSupport = other.fGeometryShaderSupport; | 1042 fGeometryShaderSupport = other.fGeometryShaderSupport; |
1042 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport; | 1043 fDualSourceBlendingSupport = other.fDualSourceBlendingSupport; |
1043 fBufferLockSupport = other.fBufferLockSupport; | |
1044 fPathRenderingSupport = other.fPathRenderingSupport; | 1044 fPathRenderingSupport = other.fPathRenderingSupport; |
1045 fDstReadInShaderSupport = other.fDstReadInShaderSupport; | 1045 fDstReadInShaderSupport = other.fDstReadInShaderSupport; |
1046 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport; | 1046 fDiscardRenderTargetSupport = other.fDiscardRenderTargetSupport; |
1047 fReuseScratchTextures = other.fReuseScratchTextures; | 1047 fReuseScratchTextures = other.fReuseScratchTextures; |
1048 fGpuTracingSupport = other.fGpuTracingSupport; | 1048 fGpuTracingSupport = other.fGpuTracingSupport; |
1049 | 1049 |
| 1050 fMapBufferFlags = other.fMapBufferFlags; |
| 1051 |
1050 fMaxRenderTargetSize = other.fMaxRenderTargetSize; | 1052 fMaxRenderTargetSize = other.fMaxRenderTargetSize; |
1051 fMaxTextureSize = other.fMaxTextureSize; | 1053 fMaxTextureSize = other.fMaxTextureSize; |
1052 fMaxSampleCount = other.fMaxSampleCount; | 1054 fMaxSampleCount = other.fMaxSampleCount; |
1053 | 1055 |
1054 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende
rSupport)); | 1056 memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRende
rSupport)); |
1055 | 1057 |
1056 return *this; | 1058 return *this; |
1057 } | 1059 } |
1058 | 1060 |
| 1061 static SkString map_flags_to_string(uint32_t flags) { |
| 1062 SkString str; |
| 1063 if (GrDrawTargetCaps::kNone_MapFlags == flags) { |
| 1064 str = "none"; |
| 1065 } else { |
| 1066 SkASSERT(GrDrawTargetCaps::kCanMap_MapFlag & flags); |
| 1067 SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kCanMap_MapFlag); |
| 1068 str = "can_map"; |
| 1069 |
| 1070 if (GrDrawTargetCaps::kSubset_MapFlag & flags) { |
| 1071 str.append(" partial"); |
| 1072 } else { |
| 1073 str.append(" full"); |
| 1074 } |
| 1075 SkDEBUGCODE(flags &= ~GrDrawTargetCaps::kSubset_MapFlag); |
| 1076 } |
| 1077 SkASSERT(0 == flags); // Make sure we handled all the flags. |
| 1078 return str; |
| 1079 } |
| 1080 |
1059 SkString GrDrawTargetCaps::dump() const { | 1081 SkString GrDrawTargetCaps::dump() const { |
1060 SkString r; | 1082 SkString r; |
1061 static const char* gNY[] = {"NO", "YES"}; | 1083 static const char* gNY[] = {"NO", "YES"}; |
1062 r.appendf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]); | 1084 r.appendf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]); |
1063 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); | 1085 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); |
1064 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport
]); | 1086 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport
]); |
1065 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport
]); | 1087 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport
]); |
1066 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]
); | 1088 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]
); |
1067 r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); | 1089 r.appendf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]); |
1068 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSuppor
t]); | 1090 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSuppor
t]); |
1069 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]
); | 1091 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]
); |
1070 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupp
ort]); | 1092 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupp
ort]); |
1071 r.appendf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); | |
1072 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport])
; | 1093 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport])
; |
1073 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport
]); | 1094 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport
]); |
1074 r.appendf("Discard Render Target Support: %s\n", gNY[fDiscardRenderTargetSup
port]); | 1095 r.appendf("Discard Render Target Support: %s\n", gNY[fDiscardRenderTargetSup
port]); |
1075 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures])
; | 1096 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures])
; |
1076 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSupport]); | 1097 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSupport]); |
1077 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); | 1098 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); |
1078 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize); | 1099 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize); |
1079 r.appendf("Max Sample Count : %d\n", fMaxSampleCount); | 1100 r.appendf("Max Sample Count : %d\n", fMaxSampleCount); |
1080 | 1101 |
| 1102 r.appendf("Map Buffer Support : %s\n", map_flags_to_string(fMapBuf
ferFlags).c_str()); |
| 1103 |
1081 static const char* kConfigNames[] = { | 1104 static const char* kConfigNames[] = { |
1082 "Unknown", // kUnknown_GrPixelConfig | 1105 "Unknown", // kUnknown_GrPixelConfig |
1083 "Alpha8", // kAlpha_8_GrPixelConfig, | 1106 "Alpha8", // kAlpha_8_GrPixelConfig, |
1084 "Index8", // kIndex_8_GrPixelConfig, | 1107 "Index8", // kIndex_8_GrPixelConfig, |
1085 "RGB565", // kRGB_565_GrPixelConfig, | 1108 "RGB565", // kRGB_565_GrPixelConfig, |
1086 "RGBA444", // kRGBA_4444_GrPixelConfig, | 1109 "RGBA444", // kRGBA_4444_GrPixelConfig, |
1087 "RGBA8888", // kRGBA_8888_GrPixelConfig, | 1110 "RGBA8888", // kRGBA_8888_GrPixelConfig, |
1088 "BGRA8888", // kBGRA_8888_GrPixelConfig, | 1111 "BGRA8888", // kBGRA_8888_GrPixelConfig, |
1089 }; | 1112 }; |
1090 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); | 1113 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); |
(...skipping 10 matching lines...) Expand all Loading... |
1101 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1124 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
1102 if (i != kUnknown_GrPixelConfig) { | 1125 if (i != kUnknown_GrPixelConfig) { |
1103 r.appendf("%s is renderable: %s, with MSAA: %s\n", | 1126 r.appendf("%s is renderable: %s, with MSAA: %s\n", |
1104 kConfigNames[i], | 1127 kConfigNames[i], |
1105 gNY[fConfigRenderSupport[i][0]], | 1128 gNY[fConfigRenderSupport[i][0]], |
1106 gNY[fConfigRenderSupport[i][1]]); | 1129 gNY[fConfigRenderSupport[i][1]]); |
1107 } | 1130 } |
1108 } | 1131 } |
1109 return r; | 1132 return r; |
1110 } | 1133 } |
OLD | NEW |