| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 fUseDrawInsteadOfClear = false; | 100 fUseDrawInsteadOfClear = false; |
| 101 | 101 |
| 102 fBlendEquationSupport = kBasic_BlendEquationSupport; | 102 fBlendEquationSupport = kBasic_BlendEquationSupport; |
| 103 fAdvBlendEqBlacklist = 0; | 103 fAdvBlendEqBlacklist = 0; |
| 104 | 104 |
| 105 fMapBufferFlags = kNone_MapFlags; | 105 fMapBufferFlags = kNone_MapFlags; |
| 106 | 106 |
| 107 fMaxRenderTargetSize = 1; | 107 fMaxRenderTargetSize = 1; |
| 108 fMaxTextureSize = 1; | 108 fMaxTextureSize = 1; |
| 109 fMinTextureSize = 1; | |
| 110 fMaxSampleCount = 0; | 109 fMaxSampleCount = 0; |
| 111 | 110 |
| 112 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); | 111 memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); |
| 113 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); | 112 memset(fConfigTextureSupport, 0, sizeof(fConfigTextureSupport)); |
| 114 | 113 |
| 115 fSupressPrints = options.fSuppressPrints; | 114 fSupressPrints = options.fSuppressPrints; |
| 116 fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedText
ure; | 115 fDrawPathMasksToCompressedTextureSupport = options.fDrawPathToCompressedText
ure; |
| 117 fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold; | 116 fGeometryBufferMapThreshold = options.fGeometryBufferMapThreshold; |
| 118 fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartial
RenderTargetWrite; | 117 fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartial
RenderTargetWrite; |
| 119 | 118 |
| 120 fPreferVRAMUseOverFlushes = true; | 119 fPreferVRAMUseOverFlushes = true; |
| 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 fMinTextureSize = SkTMax(fMinTextureSize, options.fMinTextureSizeOverride); | |
| 126 } | 124 } |
| 127 | 125 |
| 128 static SkString map_flags_to_string(uint32_t flags) { | 126 static SkString map_flags_to_string(uint32_t flags) { |
| 129 SkString str; | 127 SkString str; |
| 130 if (GrCaps::kNone_MapFlags == flags) { | 128 if (GrCaps::kNone_MapFlags == flags) { |
| 131 str = "none"; | 129 str = "none"; |
| 132 } else { | 130 } else { |
| 133 SkASSERT(GrCaps::kCanMap_MapFlag & flags); | 131 SkASSERT(GrCaps::kCanMap_MapFlag & flags); |
| 134 SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag); | 132 SkDEBUGCODE(flags &= ~GrCaps::kCanMap_MapFlag); |
| 135 str = "can_map"; | 133 str = "can_map"; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 165 r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOf
Clear]); | 163 r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOf
Clear]); |
| 166 r.appendf("Draw Instead of TexSubImage [workaround] : %s\n", | 164 r.appendf("Draw Instead of TexSubImage [workaround] : %s\n", |
| 167 gNY[fUseDrawInsteadOfPartialRenderTargetWrite]); | 165 gNY[fUseDrawInsteadOfPartialRenderTargetWrite]); |
| 168 r.appendf("Prefer VRAM Use over flushes [workaround] : %s\n", gNY[fPreferVRA
MUseOverFlushes]); | 166 r.appendf("Prefer VRAM Use over flushes [workaround] : %s\n", gNY[fPreferVRA
MUseOverFlushes]); |
| 169 | 167 |
| 170 if (this->advancedBlendEquationSupport()) { | 168 if (this->advancedBlendEquationSupport()) { |
| 171 r.appendf("Advanced Blend Equation Blacklist : 0x%x\n", fAdvBlendEqBlac
klist); | 169 r.appendf("Advanced Blend Equation Blacklist : 0x%x\n", fAdvBlendEqBlac
klist); |
| 172 } | 170 } |
| 173 | 171 |
| 174 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); | 172 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); |
| 175 r.appendf("Min Texture Size : %d\n", fMinTextureSize); | |
| 176 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize)
; | 173 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize)
; |
| 177 r.appendf("Max Sample Count : %d\n", fMaxSampleCount); | 174 r.appendf("Max Sample Count : %d\n", fMaxSampleCount); |
| 178 | 175 |
| 179 static const char* kBlendEquationSupportNames[] = { | 176 static const char* kBlendEquationSupportNames[] = { |
| 180 "Basic", | 177 "Basic", |
| 181 "Advanced", | 178 "Advanced", |
| 182 "Advanced Coherent", | 179 "Advanced Coherent", |
| 183 }; | 180 }; |
| 184 GR_STATIC_ASSERT(0 == kBasic_BlendEquationSupport); | 181 GR_STATIC_ASSERT(0 == kBasic_BlendEquationSupport); |
| 185 GR_STATIC_ASSERT(1 == kAdvanced_BlendEquationSupport); | 182 GR_STATIC_ASSERT(1 == kAdvanced_BlendEquationSupport); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); | 235 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); |
| 239 | 236 |
| 240 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 237 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| 241 r.appendf("%s is uploadable to a texture: %s\n", | 238 r.appendf("%s is uploadable to a texture: %s\n", |
| 242 kConfigNames[i], | 239 kConfigNames[i], |
| 243 gNY[fConfigTextureSupport[i]]); | 240 gNY[fConfigTextureSupport[i]]); |
| 244 } | 241 } |
| 245 | 242 |
| 246 return r; | 243 return r; |
| 247 } | 244 } |
| OLD | NEW |