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 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 fMultisampleDisableSupport = false; | 99 fMultisampleDisableSupport = false; |
100 fUsesMixedSamples = false; | 100 fUsesMixedSamples = false; |
101 fPreferClientSideDynamicBuffers = false; | 101 fPreferClientSideDynamicBuffers = false; |
102 fSupportsInstancedDraws = false; | 102 fSupportsInstancedDraws = false; |
103 fFullClearIsFree = false; | 103 fFullClearIsFree = false; |
104 fMustClearUploadedBufferData = false; | 104 fMustClearUploadedBufferData = false; |
105 fSampleShadingSupport = false; | 105 fSampleShadingSupport = false; |
106 | 106 |
107 fUseDrawInsteadOfClear = false; | 107 fUseDrawInsteadOfClear = false; |
108 | 108 |
| 109 fInstancedSupport = InstancedSupport::kNone; |
| 110 |
109 fBlendEquationSupport = kBasic_BlendEquationSupport; | 111 fBlendEquationSupport = kBasic_BlendEquationSupport; |
110 fAdvBlendEqBlacklist = 0; | 112 fAdvBlendEqBlacklist = 0; |
111 | 113 |
112 fMapBufferFlags = kNone_MapFlags; | 114 fMapBufferFlags = kNone_MapFlags; |
113 | 115 |
114 fMaxVertexAttributes = 0; | 116 fMaxVertexAttributes = 0; |
115 fMaxRenderTargetSize = 1; | 117 fMaxRenderTargetSize = 1; |
116 fMaxTextureSize = 1; | 118 fMaxTextureSize = 1; |
117 fMaxColorSampleCount = 0; | 119 fMaxColorSampleCount = 0; |
118 fMaxStencilSampleCount = 0; | 120 fMaxStencilSampleCount = 0; |
119 fMaxRasterSamples = 0; | 121 fMaxRasterSamples = 0; |
120 | 122 |
121 fSuppressPrints = options.fSuppressPrints; | 123 fSuppressPrints = options.fSuppressPrints; |
122 fImmediateFlush = options.fImmediateMode; | 124 fImmediateFlush = options.fImmediateMode; |
123 fBufferMapThreshold = options.fBufferMapThreshold; | 125 fBufferMapThreshold = options.fBufferMapThreshold; |
124 fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartial
RenderTargetWrite; | 126 fUseDrawInsteadOfPartialRenderTargetWrite = options.fUseDrawInsteadOfPartial
RenderTargetWrite; |
125 fUseDrawInsteadOfAllRenderTargetWrites = false; | 127 fUseDrawInsteadOfAllRenderTargetWrites = false; |
| 128 fAvoidInstancedDrawsToFPTargets = false; |
126 | 129 |
127 fPreferVRAMUseOverFlushes = true; | 130 fPreferVRAMUseOverFlushes = true; |
128 } | 131 } |
129 | 132 |
130 void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { | 133 void GrCaps::applyOptionsOverrides(const GrContextOptions& options) { |
131 fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride); | 134 fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride); |
132 // If the max tile override is zero, it means we should use the max texture
size. | 135 // If the max tile override is zero, it means we should use the max texture
size. |
133 if (!options.fMaxTileSizeOverride || options.fMaxTileSizeOverride > fMaxText
ureSize) { | 136 if (!options.fMaxTileSizeOverride || options.fMaxTileSizeOverride > fMaxText
ureSize) { |
134 fMaxTileSize = fMaxTextureSize; | 137 fMaxTileSize = fMaxTextureSize; |
135 } else { | 138 } else { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 r.appendf("Advanced Blend Equation Blacklist : 0x%x\n", fAdvBlendEqBlac
klist); | 193 r.appendf("Advanced Blend Equation Blacklist : 0x%x\n", fAdvBlendEqBlac
klist); |
191 } | 194 } |
192 | 195 |
193 r.appendf("Max Vertex Attributes : %d\n", fMaxVertexAttributes)
; | 196 r.appendf("Max Vertex Attributes : %d\n", fMaxVertexAttributes)
; |
194 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); | 197 r.appendf("Max Texture Size : %d\n", fMaxTextureSize); |
195 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize)
; | 198 r.appendf("Max Render Target Size : %d\n", fMaxRenderTargetSize)
; |
196 r.appendf("Max Color Sample Count : %d\n", fMaxColorSampleCount)
; | 199 r.appendf("Max Color Sample Count : %d\n", fMaxColorSampleCount)
; |
197 r.appendf("Max Stencil Sample Count : %d\n", fMaxStencilSampleCoun
t); | 200 r.appendf("Max Stencil Sample Count : %d\n", fMaxStencilSampleCoun
t); |
198 r.appendf("Max Raster Samples : %d\n", fMaxRasterSamples); | 201 r.appendf("Max Raster Samples : %d\n", fMaxRasterSamples); |
199 | 202 |
| 203 static const char* kInstancedSupportNames[] = { |
| 204 "None", |
| 205 "Basic", |
| 206 "Multisampled", |
| 207 "Mixed Sampled", |
| 208 }; |
| 209 GR_STATIC_ASSERT(0 == (int)InstancedSupport::kNone); |
| 210 GR_STATIC_ASSERT(1 == (int)InstancedSupport::kBasic); |
| 211 GR_STATIC_ASSERT(2 == (int)InstancedSupport::kMultisampled); |
| 212 GR_STATIC_ASSERT(3 == (int)InstancedSupport::kMixedSampled); |
| 213 GR_STATIC_ASSERT(4 == SK_ARRAY_COUNT(kInstancedSupportNames)); |
| 214 |
| 215 r.appendf("Instanced Support : %s\n", |
| 216 kInstancedSupportNames[(int)fInstancedSupport]); |
| 217 |
200 static const char* kBlendEquationSupportNames[] = { | 218 static const char* kBlendEquationSupportNames[] = { |
201 "Basic", | 219 "Basic", |
202 "Advanced", | 220 "Advanced", |
203 "Advanced Coherent", | 221 "Advanced Coherent", |
204 }; | 222 }; |
205 GR_STATIC_ASSERT(0 == kBasic_BlendEquationSupport); | 223 GR_STATIC_ASSERT(0 == kBasic_BlendEquationSupport); |
206 GR_STATIC_ASSERT(1 == kAdvanced_BlendEquationSupport); | 224 GR_STATIC_ASSERT(1 == kAdvanced_BlendEquationSupport); |
207 GR_STATIC_ASSERT(2 == kAdvancedCoherent_BlendEquationSupport); | 225 GR_STATIC_ASSERT(2 == kAdvancedCoherent_BlendEquationSupport); |
208 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kBlendEquationSupportNames) == kLast_BlendEq
uationSupport + 1); | 226 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kBlendEquationSupportNames) == kLast_BlendEq
uationSupport + 1); |
209 | 227 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 281 |
264 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 282 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
265 GrPixelConfig config = static_cast<GrPixelConfig>(i); | 283 GrPixelConfig config = static_cast<GrPixelConfig>(i); |
266 r.appendf("%s is uploadable to a texture: %s\n", | 284 r.appendf("%s is uploadable to a texture: %s\n", |
267 kConfigNames[i], | 285 kConfigNames[i], |
268 gNY[this->isConfigTexturable(config)]); | 286 gNY[this->isConfigTexturable(config)]); |
269 } | 287 } |
270 | 288 |
271 return r; | 289 return r; |
272 } | 290 } |
OLD | NEW |