| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 fFloatPrecisions[s][p].fBits); | 70 fFloatPrecisions[s][p].fBits); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 return r; | 75 return r; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { | 78 void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { |
| 79 fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppres
sDualSourceBlending; | 79 fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppres
sDualSourceBlending; |
| 80 this->onApplyOptionsOverrides(options); | |
| 81 } | 80 } |
| 82 | 81 |
| 83 /////////////////////////////////////////////////////////////////////////////// | 82 /////////////////////////////////////////////////////////////////////////////// |
| 84 | 83 |
| 85 GrCaps::GrCaps(const GrContextOptions& options) { | 84 GrCaps::GrCaps(const GrContextOptions& options) { |
| 86 fMipMapSupport = false; | 85 fMipMapSupport = false; |
| 87 fNPOTTextureTileSupport = false; | 86 fNPOTTextureTileSupport = false; |
| 88 fTwoSidedStencilSupport = false; | 87 fTwoSidedStencilSupport = false; |
| 89 fStencilWrapOpsSupport = false; | 88 fStencilWrapOpsSupport = false; |
| 90 fDiscardRenderTargetSupport = false; | 89 fDiscardRenderTargetSupport = false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 121 } | 120 } |
| 122 | 121 |
| 123 void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { | 122 void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { |
| 124 fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride); | 123 fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride); |
| 125 // If the max tile override is zero, it means we should use the max texture
size. | 124 // If the max tile override is zero, it means we should use the max texture
size. |
| 126 if (!options.fMaxTileSizeOverride || options.fMaxTileSizeOverride > fMaxText
ureSize) { | 125 if (!options.fMaxTileSizeOverride || options.fMaxTileSizeOverride > fMaxText
ureSize) { |
| 127 fMaxTileSize = fMaxTextureSize; | 126 fMaxTileSize = fMaxTextureSize; |
| 128 } else { | 127 } else { |
| 129 fMaxTileSize = options.fMaxTileSizeOverride; | 128 fMaxTileSize = options.fMaxTileSizeOverride; |
| 130 } | 129 } |
| 131 this->onApplyOptionsOverrides(options); | |
| 132 } | 130 } |
| 133 | 131 |
| 134 static SkString map_flags_to_string(uint32_t flags) { | 132 static SkString map_flags_to_string(uint32_t flags) { |
| 135 SkString str; | 133 SkString str; |
| 136 if (GrCaps::kNone_MapFlags == flags) { | 134 if (GrCaps::kNone_MapFlags == flags) { |
| 137 str = "none"; | 135 str = "none"; |
| 138 } else { | 136 } else { |
| 139 SkASSERT(GrCaps::kCanMap_MapFlag & flags); | 137 SkASSERT(GrCaps::kCanMap_MapFlag & flags); |
| 140 SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag); | 138 SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag); |
| 141 str = "can_map"; | 139 str = "can_map"; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); | 241 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); |
| 244 | 242 |
| 245 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 243 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| 246 r.appendf("%s is uploadable to a texture: %s\n", | 244 r.appendf("%s is uploadable to a texture: %s\n", |
| 247 kConfigNames[i], | 245 kConfigNames[i], |
| 248 gNY[fConfigTextureSupport[i]]); | 246 gNY[fConfigTextureSupport[i]]); |
| 249 } | 247 } |
| 250 | 248 |
| 251 return r; | 249 return r; |
| 252 } | 250 } |
| OLD | NEW |