OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 #include "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { | 76 void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { |
77 fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppres
sDualSourceBlending; | 77 fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppres
sDualSourceBlending; |
78 this->onApplyOptionsOverrides(options); | 78 this->onApplyOptionsOverrides(options); |
79 } | 79 } |
80 | 80 |
81 /////////////////////////////////////////////////////////////////////////////// | 81 /////////////////////////////////////////////////////////////////////////////// |
82 | 82 |
83 GrCaps::GrCaps(const GrContextOptions& options) { | 83 GrCaps::GrCaps(const GrContextOptions& options) { |
84 fMipMapSupport = false; | 84 fMipMapSupport = false; |
85 fNPOTTextureTileSupport = false; | 85 fNPOTTextureTileSupport = false; |
86 fSRGBSupport = false; | |
87 fTwoSidedStencilSupport = false; | 86 fTwoSidedStencilSupport = false; |
88 fStencilWrapOpsSupport = false; | 87 fStencilWrapOpsSupport = false; |
89 fDiscardRenderTargetSupport = false; | 88 fDiscardRenderTargetSupport = false; |
90 fReuseScratchTextures = true; | 89 fReuseScratchTextures = true; |
91 fReuseScratchBuffers = true; | 90 fReuseScratchBuffers = true; |
92 fGpuTracingSupport = false; | 91 fGpuTracingSupport = false; |
93 fCompressedTexSubImageSupport = false; | 92 fCompressedTexSubImageSupport = false; |
94 fOversizedStencilSupport = false; | 93 fOversizedStencilSupport = false; |
95 fTextureBarrierSupport = false; | 94 fTextureBarrierSupport = false; |
96 fSampleLocationsSupport = false; | 95 fSampleLocationsSupport = false; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 150 } |
152 SkASSERT(0 == flags); // Make sure we handled all the flags. | 151 SkASSERT(0 == flags); // Make sure we handled all the flags. |
153 return str; | 152 return str; |
154 } | 153 } |
155 | 154 |
156 SkString GrCaps::dump() const { | 155 SkString GrCaps::dump() const { |
157 SkString r; | 156 SkString r; |
158 static const char* gNY[] = {"NO", "YES"}; | 157 static const char* gNY[] = {"NO", "YES"}; |
159 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); | 158 r.appendf("MIP Map Support : %s\n", gNY[fMipMapSupport]); |
160 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileS
upport]); | 159 r.appendf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileS
upport]); |
161 r.appendf("sRGB Support : %s\n", gNY[fSRGBSupport]); | |
162 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilS
upport]); | 160 r.appendf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilS
upport]); |
163 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSu
pport]); | 161 r.appendf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSu
pport]); |
164 r.appendf("Discard Render Target Support : %s\n", gNY[fDiscardRenderTar
getSupport]); | 162 r.appendf("Discard Render Target Support : %s\n", gNY[fDiscardRenderTar
getSupport]); |
165 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchText
ures]); | 163 r.appendf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchText
ures]); |
166 r.appendf("Reuse Scratch Buffers : %s\n", gNY[fReuseScratchBuff
ers]); | 164 r.appendf("Reuse Scratch Buffers : %s\n", gNY[fReuseScratchBuff
ers]); |
167 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSuppor
t]); | 165 r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSuppor
t]); |
168 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSub
ImageSupport]); | 166 r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSub
ImageSupport]); |
169 r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencil
Support]); | 167 r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencil
Support]); |
170 r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSu
pport]); | 168 r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSu
pport]); |
171 r.appendf("Sample Locations Support : %s\n", gNY[fSampleLocationsS
upport]); | 169 r.appendf("Sample Locations Support : %s\n", gNY[fSampleLocationsS
upport]); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 203 |
206 static const char* kConfigNames[] = { | 204 static const char* kConfigNames[] = { |
207 "Unknown", // kUnknown_GrPixelConfig | 205 "Unknown", // kUnknown_GrPixelConfig |
208 "Alpha8", // kAlpha_8_GrPixelConfig, | 206 "Alpha8", // kAlpha_8_GrPixelConfig, |
209 "Index8", // kIndex_8_GrPixelConfig, | 207 "Index8", // kIndex_8_GrPixelConfig, |
210 "RGB565", // kRGB_565_GrPixelConfig, | 208 "RGB565", // kRGB_565_GrPixelConfig, |
211 "RGBA444", // kRGBA_4444_GrPixelConfig, | 209 "RGBA444", // kRGBA_4444_GrPixelConfig, |
212 "RGBA8888", // kRGBA_8888_GrPixelConfig, | 210 "RGBA8888", // kRGBA_8888_GrPixelConfig, |
213 "BGRA8888", // kBGRA_8888_GrPixelConfig, | 211 "BGRA8888", // kBGRA_8888_GrPixelConfig, |
214 "SRGBA8888",// kSRGBA_8888_GrPixelConfig, | 212 "SRGBA8888",// kSRGBA_8888_GrPixelConfig, |
215 "SBGRA8888",// kSBGRA_8888_GrPixelConfig, | |
216 "ETC1", // kETC1_GrPixelConfig, | 213 "ETC1", // kETC1_GrPixelConfig, |
217 "LATC", // kLATC_GrPixelConfig, | 214 "LATC", // kLATC_GrPixelConfig, |
218 "R11EAC", // kR11_EAC_GrPixelConfig, | 215 "R11EAC", // kR11_EAC_GrPixelConfig, |
219 "ASTC12x12",// kASTC_12x12_GrPixelConfig, | 216 "ASTC12x12",// kASTC_12x12_GrPixelConfig, |
220 "RGBAFloat",// kRGBA_float_GrPixelConfig | 217 "RGBAFloat",// kRGBA_float_GrPixelConfig |
221 "AlphaHalf",// kAlpha_half_GrPixelConfig | 218 "AlphaHalf",// kAlpha_half_GrPixelConfig |
222 "RGBAHalf", // kRGBA_half_GrPixelConfig | 219 "RGBAHalf", // kRGBA_half_GrPixelConfig |
223 }; | 220 }; |
224 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); | 221 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); |
225 GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig); | 222 GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig); |
226 GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig); | 223 GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig); |
227 GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig); | 224 GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig); |
228 GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig); | 225 GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig); |
229 GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); | 226 GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); |
230 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); | 227 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); |
231 GR_STATIC_ASSERT(7 == kSRGBA_8888_GrPixelConfig); | 228 GR_STATIC_ASSERT(7 == kSRGBA_8888_GrPixelConfig); |
232 GR_STATIC_ASSERT(8 == kSBGRA_8888_GrPixelConfig); | 229 GR_STATIC_ASSERT(8 == kETC1_GrPixelConfig); |
233 GR_STATIC_ASSERT(9 == kETC1_GrPixelConfig); | 230 GR_STATIC_ASSERT(9 == kLATC_GrPixelConfig); |
234 GR_STATIC_ASSERT(10 == kLATC_GrPixelConfig); | 231 GR_STATIC_ASSERT(10 == kR11_EAC_GrPixelConfig); |
235 GR_STATIC_ASSERT(11 == kR11_EAC_GrPixelConfig); | 232 GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig); |
236 GR_STATIC_ASSERT(12 == kASTC_12x12_GrPixelConfig); | 233 GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig); |
237 GR_STATIC_ASSERT(13 == kRGBA_float_GrPixelConfig); | 234 GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig); |
238 GR_STATIC_ASSERT(14 == kAlpha_half_GrPixelConfig); | 235 GR_STATIC_ASSERT(14 == kRGBA_half_GrPixelConfig); |
239 GR_STATIC_ASSERT(15 == kRGBA_half_GrPixelConfig); | |
240 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt); | 236 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt); |
241 | 237 |
242 SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig, false)); | 238 SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig, false)); |
243 SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig, true)); | 239 SkASSERT(!this->isConfigRenderable(kUnknown_GrPixelConfig, true)); |
244 | 240 |
245 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 241 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
246 GrPixelConfig config = static_cast<GrPixelConfig>(i); | 242 GrPixelConfig config = static_cast<GrPixelConfig>(i); |
247 r.appendf("%s is renderable: %s, with MSAA: %s\n", | 243 r.appendf("%s is renderable: %s, with MSAA: %s\n", |
248 kConfigNames[i], | 244 kConfigNames[i], |
249 gNY[this->isConfigRenderable(config, false)], | 245 gNY[this->isConfigRenderable(config, false)], |
250 gNY[this->isConfigRenderable(config, true)]); | 246 gNY[this->isConfigRenderable(config, true)]); |
251 } | 247 } |
252 | 248 |
253 SkASSERT(!this->isConfigTexturable(kUnknown_GrPixelConfig)); | 249 SkASSERT(!this->isConfigTexturable(kUnknown_GrPixelConfig)); |
254 | 250 |
255 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 251 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
256 GrPixelConfig config = static_cast<GrPixelConfig>(i); | 252 GrPixelConfig config = static_cast<GrPixelConfig>(i); |
257 r.appendf("%s is uploadable to a texture: %s\n", | 253 r.appendf("%s is uploadable to a texture: %s\n", |
258 kConfigNames[i], | 254 kConfigNames[i], |
259 gNY[this->isConfigTexturable(config)]); | 255 gNY[this->isConfigTexturable(config)]); |
260 } | 256 } |
261 | 257 |
262 return r; | 258 return r; |
263 } | 259 } |
OLD | NEW |