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