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

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

Issue 1567733005: Add a class representing texture swizzle. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add .a for color table FP texture reads. 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/GrTextureAccess.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
11 11
12 #include "glsl/GrGLSL.h"
12 #include "GrCaps.h" 13 #include "GrCaps.h"
13 #include "glsl/GrGLSL.h"
14 #include "GrGLStencilAttachment.h" 14 #include "GrGLStencilAttachment.h"
15 #include "GrSwizzle.h"
15 #include "SkChecksum.h" 16 #include "SkChecksum.h"
16 #include "SkTHash.h" 17 #include "SkTHash.h"
17 #include "SkTArray.h" 18 #include "SkTArray.h"
18 19
19 class GrGLContextInfo; 20 class GrGLContextInfo;
20 class GrGLSLCaps; 21 class GrGLSLCaps;
21 22
22 /** 23 /**
23 * Stores some capabilities of a GL context. Most are determined by the GL 24 * Stores some capabilities of a GL context. Most are determined by the GL
24 * version and the extensions string. It also tracks formats that have passed 25 * version and the extensions string. It also tracks formats that have passed
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } else { 136 } else {
136 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl e_Flag); 137 return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kRenderabl e_Flag);
137 } 138 }
138 } 139 }
139 140
140 /** Returns conversions to various GL format parameters for a GrPixelCfonig. */ 141 /** Returns conversions to various GL format parameters for a GrPixelCfonig. */
141 const ConfigFormats& configGLFormats(GrPixelConfig config) const { 142 const ConfigFormats& configGLFormats(GrPixelConfig config) const {
142 return fConfigTable[config].fFormats; 143 return fConfigTable[config].fFormats;
143 } 144 }
144 145
146 /** Returns the mapping between GrPixelConfig components and GL internal for mat components. */
147 const GrSwizzle& configSwizzle(GrPixelConfig config) const {
148 return fConfigTable[config].fSwizzle;
149 }
150
145 /** 151 /**
146 * Gets an array of legal stencil formats. These formats are not guaranteed 152 * 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 153 * to be supported by the driver but are legal GLenum names given the GL
148 * version and extensions supported. 154 * version and extensions supported.
149 */ 155 */
150 const SkTArray<StencilFormat, true>& stencilFormats() const { 156 const SkTArray<StencilFormat, true>& stencilFormats() const {
151 return fStencilFormats; 157 return fStencilFormats;
152 } 158 }
153 159
154 /** 160 /**
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 306
301 bool isCoreProfile() const { return fIsCoreProfile; } 307 bool isCoreProfile() const { return fIsCoreProfile; }
302 308
303 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSuppo rt; } 309 bool bindFragDataLocationSupport() const { return fBindFragDataLocationSuppo rt; }
304 310
305 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport ; } 311 bool bindUniformLocationSupport() const { return fBindUniformLocationSupport ; }
306 312
307 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported. 313 /// Are textures with GL_TEXTURE_EXTERNAL_OES type supported.
308 bool externalTextureSupport() const { return fExternalTextureSupport; } 314 bool externalTextureSupport() const { return fExternalTextureSupport; }
309 315
316 /// GL_ARB_texture_swizzle
317 bool textureSwizzleSupport() const { return fTextureSwizzleSupport; }
318
310 /** 319 /**
311 * Is there support for enabling/disabling sRGB writes for sRGB-capable colo r attachments? 320 * Is there support for enabling/disabling sRGB writes for sRGB-capable colo r attachments?
312 * If false this does not mean sRGB is not supported but rather that if it i s supported 321 * 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. 322 * it cannot be turned off for configs that support it.
314 */ 323 */
315 bool srgbWriteControl() const { return fSRGBWriteControl; } 324 bool srgbWriteControl() const { return fSRGBWriteControl; }
316 325
317 /** 326 /**
318 * Returns a string containing the caps info. 327 * Returns a string containing the caps info.
319 */ 328 */
320 SkString dump() const override; 329 SkString dump() const override;
321 330
322 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; } 331 bool rgba8888PixelsOpsAreSlow() const { return fRGBA8888PixelsOpsAreSlow; }
323 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; } 332 bool partialFBOReadIsSlow() const { return fPartialFBOReadIsSlow; }
324 333
325 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS haderCaps.get()); } 334 const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fS haderCaps.get()); }
326 335
327 private: 336 private:
328 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa ce*); 337 void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterfa ce*);
329 void initGLSL(const GrGLContextInfo&); 338 void initGLSL(const GrGLContextInfo&);
330 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*); 339 bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*);
331 340
332 void onApplyOptionsOverrides(const GrContextOptions& options) override; 341 void onApplyOptionsOverrides(const GrContextOptions& options) override;
333 342
334 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*); 343 void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*);
335 void initBlendEqationSupport(const GrGLContextInfo&); 344 void initBlendEqationSupport(const GrGLContextInfo&);
336 void initStencilFormats(const GrGLContextInfo&); 345 void initStencilFormats(const GrGLContextInfo&);
337 // This must be called after initFSAASupport(). 346 // This must be called after initFSAASupport().
338 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli); 347 void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrGLS LCaps* glslCaps);
339 348
340 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, 349 void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
341 const GrGLInterface* intf, 350 const GrGLInterface* intf,
342 GrGLSLCaps* glslCaps); 351 GrGLSLCaps* glslCaps);
343 352
344 void initConfigSwizzleTable(const GrGLContextInfo& ctxInfo, GrGLSLCaps* glsl Caps);
345
346
347 SkTArray<StencilFormat, true> fStencilFormats; 353 SkTArray<StencilFormat, true> fStencilFormats;
348 354
349 int fMaxFragmentUniformVectors; 355 int fMaxFragmentUniformVectors;
350 int fMaxVertexAttributes; 356 int fMaxVertexAttributes;
351 int fMaxFragmentTextureUnits; 357 int fMaxFragmentTextureUnits;
352 358
353 MSFBOType fMSFBOType; 359 MSFBOType fMSFBOType;
354 InvalidateFBType fInvalidateFBType; 360 InvalidateFBType fInvalidateFBType;
355 MapBufferType fMapBufferType; 361 MapBufferType fMapBufferType;
356 TransferBufferType fTransferBufferType; 362 TransferBufferType fTransferBufferType;
(...skipping 12 matching lines...) Expand all
369 bool fES2CompatibilitySupport : 1; 375 bool fES2CompatibilitySupport : 1;
370 bool fMultisampleDisableSupport : 1; 376 bool fMultisampleDisableSupport : 1;
371 bool fUseNonVBOVertexAndIndexDynamicData : 1; 377 bool fUseNonVBOVertexAndIndexDynamicData : 1;
372 bool fIsCoreProfile : 1; 378 bool fIsCoreProfile : 1;
373 bool fBindFragDataLocationSupport : 1; 379 bool fBindFragDataLocationSupport : 1;
374 bool fSRGBWriteControl : 1; 380 bool fSRGBWriteControl : 1;
375 bool fRGBA8888PixelsOpsAreSlow : 1; 381 bool fRGBA8888PixelsOpsAreSlow : 1;
376 bool fPartialFBOReadIsSlow : 1; 382 bool fPartialFBOReadIsSlow : 1;
377 bool fBindUniformLocationSupport : 1; 383 bool fBindUniformLocationSupport : 1;
378 bool fExternalTextureSupport : 1; 384 bool fExternalTextureSupport : 1;
385 bool fTextureSwizzleSupport : 1;
379 386
380 /** Number type of the components (with out considering number of bits.) */ 387 /** Number type of the components (with out considering number of bits.) */
381 enum FormatType { 388 enum FormatType {
382 kNormalizedFixedPoint_FormatType, 389 kNormalizedFixedPoint_FormatType,
383 kFloat_FormatType, 390 kFloat_FormatType,
384 }; 391 };
385 392
386 struct ReadPixelsFormat { 393 struct ReadPixelsFormat {
387 ReadPixelsFormat() : fFormat(0), fType(0) {} 394 ReadPixelsFormat() : fFormat(0), fType(0) {}
388 GrGLenum fFormat; 395 GrGLenum fFormat;
(...skipping 22 matching lines...) Expand all
411 // Index fStencilFormats. 418 // Index fStencilFormats.
412 int fStencilFormatIndex; 419 int fStencilFormatIndex;
413 420
414 enum { 421 enum {
415 kVerifiedColorAttachment_Flag = 0x1, 422 kVerifiedColorAttachment_Flag = 0x1,
416 kTextureable_Flag = 0x2, 423 kTextureable_Flag = 0x2,
417 kRenderable_Flag = 0x4, 424 kRenderable_Flag = 0x4,
418 kRenderableWithMSAA_Flag = 0x8, 425 kRenderableWithMSAA_Flag = 0x8,
419 }; 426 };
420 uint32_t fFlags; 427 uint32_t fFlags;
428
429 GrSwizzle fSwizzle;
421 }; 430 };
422 431
423 ConfigInfo fConfigTable[kGrPixelConfigCnt]; 432 ConfigInfo fConfigTable[kGrPixelConfigCnt];
424 433
425 typedef GrCaps INHERITED; 434 typedef GrCaps INHERITED;
426 }; 435 };
427 436
428 #endif 437 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTextureAccess.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698