Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/gpu/gl/GrGLCaps.h

Issue 1569103003: Revert of Move config texturability/renderability to config table (Closed) Base URL: https://skia.googlesource.com/skia.git@readpixformat
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 8
9 #ifndef GrGLCaps_DEFINED 9 #ifndef GrGLCaps_DEFINED
10 #define GrGLCaps_DEFINED 10 #define GrGLCaps_DEFINED
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 kLast_TransferBufferType = kChromium_TransferBufferType, 116 kLast_TransferBufferType = kChromium_TransferBufferType,
117 }; 117 };
118 118
119 /** 119 /**
120 * Initializes the GrGLCaps to the set of features supported in the current 120 * Initializes the GrGLCaps to the set of features supported in the current
121 * OpenGL context accessible via ctxInfo. 121 * OpenGL context accessible via ctxInfo.
122 */ 122 */
123 GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxI nfo, 123 GrGLCaps(const GrContextOptions& contextOptions, const GrGLContextInfo& ctxI nfo,
124 const GrGLInterface* glInterface); 124 const GrGLInterface* glInterface);
125 125
126 bool isConfigTexturable(GrPixelConfig config) const override {
127 SkASSERT(kGrPixelConfigCnt > config);
128 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kTextureable_F lag);
129 }
130
131 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override {
132 SkASSERT(kGrPixelConfigCnt > config) ;
133 if (withMSAA) {
134 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl eWithMSAA_Flag);
135 } else {
136 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl e_Flag);
137 }
138 }
139
140 /** Returns conversions to various GL format parameters for a GrPixelCfonig. */ 126 /** Returns conversions to various GL format parameters for a GrPixelCfonig. */
141 const ConfigFormats& configGLFormats(GrPixelConfig config) const { 127 const ConfigFormats& configGLFormats(GrPixelConfig config) const {
142 return fConfigTable[config].fFormats; 128 return fConfigTable[config].fFormats;
143 } 129 }
144 130
131
145 /** 132 /**
146 * Gets an array of legal stencil formats. These formats are not guaranteed 133 * Gets an array of legal stencil formats. These formats are not guaranteed
147 * to be supported by the driver but are legal GLenum names given the GL 134 * to be supported by the driver but are legal GLenum names given the GL
148 * version and extensions supported. 135 * version and extensions supported.
149 */ 136 */
150 const SkTArray<StencilFormat, true>& stencilFormats() const { 137 const SkTArray<StencilFormat, true>& stencilFormats() const {
151 return fStencilFormats; 138 return fStencilFormats;
152 } 139 }
153 140
154 /** 141 /**
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 220
234 /// The maximum number of fragment uniform vectors (GLES has min. 16). 221 /// The maximum number of fragment uniform vectors (GLES has min. 16).
235 int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; } 222 int maxFragmentUniformVectors() const { return fMaxFragmentUniformVectors; }
236 223
237 /// maximum number of attribute values per vertex 224 /// maximum number of attribute values per vertex
238 int maxVertexAttributes() const { return fMaxVertexAttributes; } 225 int maxVertexAttributes() const { return fMaxVertexAttributes; }
239 226
240 /// maximum number of texture units accessible in the fragment shader. 227 /// maximum number of texture units accessible in the fragment shader.
241 int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; } 228 int maxFragmentTextureUnits() const { return fMaxFragmentTextureUnits; }
242 229
230 /// ES requires an extension to support RGBA8 in RenderBufferStorage
231 bool rgba8RenderbufferSupport() const { return fRGBA8RenderbufferSupport; }
232
243 /** 233 /**
244 * Depending on the ES extensions present the BGRA external format may 234 * Depending on the ES extensions present the BGRA external format may
245 * correspond to either a BGRA or RGBA internalFormat. On desktop GL it is 235 * correspond either a BGRA or RGBA internalFormat. On desktop GL it is
246 * RGBA. 236 * RGBA.
247 */ 237 */
248 bool bgraIsInternalFormat() const; 238 bool bgraIsInternalFormat() const { return fBGRAIsInternalFormat; }
249 239
250 /// Is there support for GL_UNPACK_ROW_LENGTH 240 /// Is there support for GL_UNPACK_ROW_LENGTH
251 bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; } 241 bool unpackRowLengthSupport() const { return fUnpackRowLengthSupport; }
252 242
253 /// Is there support for GL_UNPACK_FLIP_Y 243 /// Is there support for GL_UNPACK_FLIP_Y
254 bool unpackFlipYSupport() const { return fUnpackFlipYSupport; } 244 bool unpackFlipYSupport() const { return fUnpackFlipYSupport; }
255 245
256 /// Is there support for GL_PACK_ROW_LENGTH 246 /// Is there support for GL_PACK_ROW_LENGTH
257 bool packRowLengthSupport() const { return fPackRowLengthSupport; } 247 bool packRowLengthSupport() const { return fPackRowLengthSupport; }
258 248
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 * If false this does not mean sRGB is not supported but rather that if it i s supported 302 * If false this does not mean sRGB is not supported but rather that if it i s supported
313 * it cannot be turned off for configs that support it. 303 * it cannot be turned off for configs that support it.
314 */ 304 */
315 bool srgbWriteControl() const { return fSRGBWriteControl; } 305 bool srgbWriteControl() const { return fSRGBWriteControl; }
316 306
317 /** 307 /**
318 * Returns a string containing the caps info. 308 * Returns a string containing the caps info.
319 */ 309 */
320 SkString dump() const override; 310 SkString dump() const override;
321 311
312 /**
313 * LATC can appear under one of three possible names. In order to know
314 * which GL internal format to use, we need to keep track of which name
315 * we found LATC under. The default is LATC.
316 */
317 enum LATCAlias {
318 kLATC_LATCAlias,
319 kRGTC_LATCAlias,
320 k3DC_LATCAlias
321 };
322
323 LATCAlias latcAlias() const { return fLATCAlias; }
324
322 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; } 325 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; }
323 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; } 326 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; }
324 327
325 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS haderCaps.get()); } 328 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS haderCaps.get()); }
326 329
327 private: 330 private:
328 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa ce*); 331 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa ce*);
329 void initGLSL(const GrGLContextInfo&); 332 void initGLSL(const GrGLContextInfo&);
330 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); 333 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*);
331 334
332 void onApplyOptionsOverrides(const GrContextOptions& options) override; 335 void onApplyOptionsOverrides(const GrContextOptions& options) override;
333 336
334 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); 337 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*);
335 void initBlendEqationSupport(const GrGLContextInfo&); 338 void initBlendEqationSupport(const GrGLContextInfo&);
336 void initStencilFormats(const GrGLContextInfo&); 339 void initStencilFormats(const GrGLContextInfo&);
337 // This must be called after initFSAASupport(). 340 // This must be called after initFSAASupport().
338 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli); 341 void initConfigRenderableTable(const GrGLContextInfo&, bool srgbSupport);
342 void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*, bool srgbSupport);
339 343
340 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, 344 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
341 const GrGLInterface* intf, 345 const GrGLInterface* intf,
342 GrGLSLCaps* glslCaps); 346 GrGLSLCaps* glslCaps);
343 347
344 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl Caps); 348 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl Caps);
345 349
350 void initConfigTable(const GrGLContextInfo&);
346 351
347 SkTArray<StencilFormat, true> fStencilFormats; 352 SkTArray<StencilFormat, true> fStencilFormats;
348 353
349 int fMaxFragmentUniformVectors; 354 int fMaxFragmentUniformVectors;
350 int fMaxVertexAttributes; 355 int fMaxVertexAttributes;
351 int fMaxFragmentTextureUnits; 356 int fMaxFragmentTextureUnits;
352 357
353 MSFBOType fMSFBOType; 358 MSFBOType fMSFBOType;
354 InvalidateFBType fInvalidateFBType; 359 InvalidateFBType fInvalidateFBType;
355 MapBufferType fMapBufferType; 360 MapBufferType fMapBufferType;
356 TransferBufferType fTransferBufferType; 361 TransferBufferType fTransferBufferType;
362 LATCAlias fLATCAlias;
357 363
364 bool fRGBA8RenderbufferSupport : 1;
365 bool fBGRAIsInternalFormat : 1;
358 bool fUnpackRowLengthSupport : 1; 366 bool fUnpackRowLengthSupport : 1;
359 bool fUnpackFlipYSupport : 1; 367 bool fUnpackFlipYSupport : 1;
360 bool fPackRowLengthSupport : 1; 368 bool fPackRowLengthSupport : 1;
361 bool fPackFlipYSupport : 1; 369 bool fPackFlipYSupport : 1;
362 bool fTextureUsageSupport : 1; 370 bool fTextureUsageSupport : 1;
363 bool fTexStorageSupport : 1; 371 bool fTexStorageSupport : 1;
364 bool fTextureRedSupport : 1; 372 bool fTextureRedSupport : 1;
365 bool fImagingSupport : 1; 373 bool fImagingSupport : 1;
366 bool fVertexArrayObjectSupport : 1; 374 bool fVertexArrayObjectSupport : 1;
367 bool fDirectStateAccessSupport : 1; 375 bool fDirectStateAccessSupport : 1;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // This indicates that a stencil format has not yet been determined for the config. 413 // This indicates that a stencil format has not yet been determined for the config.
406 kUnknown_StencilIndex = -1, 414 kUnknown_StencilIndex = -1,
407 // This indicates that there is no supported stencil format for the config. 415 // This indicates that there is no supported stencil format for the config.
408 kUnsupported_StencilFormatIndex = -2 416 kUnsupported_StencilFormatIndex = -2
409 }; 417 };
410 418
411 // Index fStencilFormats. 419 // Index fStencilFormats.
412 int fStencilFormatIndex; 420 int fStencilFormatIndex;
413 421
414 enum { 422 enum {
415 kVerifiedColorAttachment_Flag = 0x1, 423 kVerifiedColorAttachment_Flag = 0x1
416 kTextureable_Flag = 0x2,
417 kRenderable_Flag = 0x4,
418 kRenderableWithMSAA_Flag = 0x8,
419 }; 424 };
420 uint32_t fFlags; 425 uint32_t fFlags;
421 }; 426 };
422 427
423 ConfigInfo fConfigTable[kGrPixelConfigCnt]; 428 ConfigInfo fConfigTable[kGrPixelConfigCnt];
424 429
425 typedef GrCaps INHERITED; 430 typedef GrCaps INHERITED;
426 }; 431 };
427 432
428 #endif 433 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698