Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrCaps.h" | 8 #include "GrCaps.h" |
| 9 #include "GrContextOptions.h" | 9 #include "GrContextOptions.h" |
| 10 #include "GrWindowRectangles.h" | |
| 10 | 11 |
| 11 GrShaderCaps::GrShaderCaps() { | 12 GrShaderCaps::GrShaderCaps() { |
| 12 fShaderDerivativeSupport = false; | 13 fShaderDerivativeSupport = false; |
| 13 fGeometryShaderSupport = false; | 14 fGeometryShaderSupport = false; |
| 14 fPathRenderingSupport = false; | 15 fPathRenderingSupport = false; |
| 15 fDstReadInShaderSupport = false; | 16 fDstReadInShaderSupport = false; |
| 16 fDualSourceBlendingSupport = false; | 17 fDualSourceBlendingSupport = false; |
| 17 fIntegerSupport = false; | 18 fIntegerSupport = false; |
| 18 fTexelBufferSupport = false; | 19 fTexelBufferSupport = false; |
| 19 fShaderPrecisionVaries = false; | 20 fShaderPrecisionVaries = false; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 fImmediateFlush = options.fImmediateMode; | 125 fImmediateFlush = options.fImmediateMode; |
| 125 fBufferMapThreshold = options.fBufferMapThreshold; | 126 fBufferMapThreshold = options.fBufferMapThreshold; |
| 126 fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartial RenderTargetWrite; | 127 fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartial RenderTargetWrite; |
| 127 fUseDrawInsteadOfAllRenderTargetWrites = false; | 128 fUseDrawInsteadOfAllRenderTargetWrites = false; |
| 128 fAvoidInstancedDrawsToFPTargets = false; | 129 fAvoidInstancedDrawsToFPTargets = false; |
| 129 | 130 |
| 130 fPreferVRAMUseOverFlushes = true; | 131 fPreferVRAMUseOverFlushes = true; |
| 131 } | 132 } |
| 132 | 133 |
| 133 void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { | 134 void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { |
| 135 this->onApplyOptionsOverrides(options); | |
| 134 fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride); | 136 fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride); |
| 135 // If the max tile override is zero, it means we should use the max texture size. | 137 // If the max tile override is zero, it means we should use the max texture size. |
| 136 if (!options.fMaxTileSizeOverride || options.fMaxTileSizeOverride > fMaxText ureSize) { | 138 if (!options.fMaxTileSizeOverride || options.fMaxTileSizeOverride > fMaxText ureSize) { |
| 137 fMaxTileSize = fMaxTextureSize; | 139 fMaxTileSize = fMaxTextureSize; |
| 138 } else { | 140 } else { |
| 139 fMaxTileSize = options.fMaxTileSizeOverride; | 141 fMaxTileSize = options.fMaxTileSizeOverride; |
| 140 } | 142 } |
| 141 this->onApplyOptionsOverrides(options); | 143 if (fMaxWindowRectangles > GrWindowRectangles::kMaxWindows) { |
| 144 fMaxWindowRectangles = GrWindowRectangles::kMaxWindows; | |
|
csmartdalton
2016/08/17 18:24:06
We still cap. The cap just got moved here instead.
| |
| 145 } | |
| 142 } | 146 } |
| 143 | 147 |
| 144 static SkString map_flags_to_string(uint32_t flags) { | 148 static SkString map_flags_to_string(uint32_t flags) { |
| 145 SkString str; | 149 SkString str; |
| 146 if (GrCaps::kNone_MapFlags == flags) { | 150 if (GrCaps::kNone_MapFlags == flags) { |
| 147 str = "none"; | 151 str = "none"; |
| 148 } else { | 152 } else { |
| 149 SkASSERT(GrCaps::kCanMap_MapFlag & flags); | 153 SkASSERT(GrCaps::kCanMap_MapFlag & flags); |
| 150 SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag); | 154 SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag); |
| 151 str = "can_map"; | 155 str = "can_map"; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 | 285 |
| 282 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 286 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| 283 GrPixelConfig config = static_cast<GrPixelConfig>(i); | 287 GrPixelConfig config = static_cast<GrPixelConfig>(i); |
| 284 r.appendf("%s is uploadable to a texture: %s\n", | 288 r.appendf("%s is uploadable to a texture: %s\n", |
| 285 kConfigNames[i], | 289 kConfigNames[i], |
| 286 gNY[this->isConfigTexturable(config)]); | 290 gNY[this->isConfigTexturable(config)]); |
| 287 } | 291 } |
| 288 | 292 |
| 289 return r; | 293 return r; |
| 290 } | 294 } |
| OLD | NEW |