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

Side by Side Diff: include/gpu/GrTypes.h

Issue 682223002: rename GrTextureDesc->GrSurfaceDesc, GrTextureFlags->GrSurfaceFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const Created 6 years, 1 month 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 | « include/gpu/GrTexture.h ('k') | src/core/SkImageFilter.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 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 9
10 10
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 case kLATC_GrPixelConfig: 412 case kLATC_GrPixelConfig:
413 case kASTC_12x12_GrPixelConfig: 413 case kASTC_12x12_GrPixelConfig:
414 case kAlpha_8_GrPixelConfig: 414 case kAlpha_8_GrPixelConfig:
415 return true; 415 return true;
416 default: 416 default:
417 return false; 417 return false;
418 } 418 }
419 } 419 }
420 420
421 /** 421 /**
422 * Optional bitfield flags that can be passed to createTexture. 422 * Optional bitfield flags that can be set on GrSurfaceDesc (below).
423 */ 423 */
424 enum GrTextureFlags { 424 enum GrSurfaceFlags {
425 kNone_GrTextureFlags = 0x0, 425 kNone_GrSurfaceFlags = 0x0,
426 /** 426 /**
427 * Creates a texture that can be rendered to as a GrRenderTarget. Use 427 * Creates a texture that can be rendered to as a GrRenderTarget. Use
428 * GrTexture::asRenderTarget() to access. 428 * GrTexture::asRenderTarget() to access.
429 */ 429 */
430 kRenderTarget_GrTextureFlagBit = 0x1, 430 kRenderTarget_GrSurfaceFlag = 0x1,
431 /** 431 /**
432 * By default all render targets have an associated stencil buffer that 432 * By default all render targets have an associated stencil buffer that
433 * may be required for path filling. This flag overrides stencil buffer 433 * may be required for path filling. This flag overrides stencil buffer
434 * creation. 434 * creation.
435 * MAKE THIS PRIVATE? 435 * MAKE THIS PRIVATE?
436 */ 436 */
437 kNoStencil_GrTextureFlagBit = 0x2, 437 kNoStencil_GrSurfaceFlag = 0x2,
438 /**
439 * Hint that the CPU may modify this texture after creation.
440 */
441 kDynamicUpdate_GrTextureFlagBit = 0x4,
442 /** 438 /**
443 * Indicates that all allocations (color buffer, FBO completeness, etc) 439 * Indicates that all allocations (color buffer, FBO completeness, etc)
444 * should be verified. 440 * should be verified.
445 */ 441 */
446 kCheckAllocation_GrTextureFlagBit = 0x8, 442 kCheckAllocation_GrSurfaceFlag = 0x4,
447 }; 443 };
448 444
449 GR_MAKE_BITFIELD_OPS(GrTextureFlags) 445 GR_MAKE_BITFIELD_OPS(GrSurfaceFlags)
446
447 // Legacy aliases
448 typedef GrSurfaceFlags GrTextureFlags;
449 static const GrSurfaceFlags kNone_GrTextureFlags = kNone_GrSurfaceFlags;
450 static const GrSurfaceFlags kRenderTarget_GrTExtureFlagBit = kRenderTarget_GrSur faceFlag;
451 static const GrSurfaceFlags kNoStencil_GrTextureFlagBit = kNoStencil_GrSurfaceFl ag;
452 static const GrSurfaceFlags kCheckAllocation_GrTextureFlagBit = kCheckAllocation _GrSurfaceFlag;
450 453
451 /** 454 /**
452 * Some textures will be stored such that the upper and left edges of the conten t meet at the 455 * Some textures will be stored such that the upper and left edges of the conten t meet at the
453 * the origin (in texture coord space) and for other textures the lower and left edges meet at 456 * the origin (in texture coord space) and for other textures the lower and left edges meet at
454 * the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render tar gets 457 * the origin. kDefault_GrSurfaceOrigin sets textures to TopLeft, and render tar gets
455 * to BottomLeft. 458 * to BottomLeft.
456 */ 459 */
457 460
458 enum GrSurfaceOrigin { 461 enum GrSurfaceOrigin {
459 kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed 462 kDefault_GrSurfaceOrigin, // DEPRECATED; to be removed
460 kTopLeft_GrSurfaceOrigin, 463 kTopLeft_GrSurfaceOrigin,
461 kBottomLeft_GrSurfaceOrigin, 464 kBottomLeft_GrSurfaceOrigin,
462 }; 465 };
463 466
464 /** 467 /**
465 * Describes a texture to be created. 468 * Describes a surface to be created.
466 */ 469 */
467 struct GrTextureDesc { 470 struct GrSurfaceDesc {
468 GrTextureDesc() 471 GrSurfaceDesc()
469 : fFlags(kNone_GrTextureFlags) 472 : fFlags(kNone_GrSurfaceFlags)
470 , fOrigin(kDefault_GrSurfaceOrigin) 473 , fOrigin(kDefault_GrSurfaceOrigin)
471 , fWidth(0) 474 , fWidth(0)
472 , fHeight(0) 475 , fHeight(0)
473 , fConfig(kUnknown_GrPixelConfig) 476 , fConfig(kUnknown_GrPixelConfig)
474 , fSampleCnt(0) { 477 , fSampleCnt(0) {
475 } 478 }
476 479
477 GrTextureFlags fFlags; //!< bitfield of TextureFlags 480 GrSurfaceFlags fFlags; //!< bitfield of TextureFlags
478 GrSurfaceOrigin fOrigin; //!< origin of the texture 481 GrSurfaceOrigin fOrigin; //!< origin of the texture
479 int fWidth; //!< Width of the texture 482 int fWidth; //!< Width of the texture
480 int fHeight; //!< Height of the texture 483 int fHeight; //!< Height of the texture
481 484
482 /** 485 /**
483 * Format of source data of the texture. Not guaranteed to be the same as 486 * Format of source data of the texture. Not guaranteed to be the same as
484 * internal format used by 3D API. 487 * internal format used by 3D API.
485 */ 488 */
486 GrPixelConfig fConfig; 489 GrPixelConfig fConfig;
487 490
488 /** 491 /**
489 * The number of samples per pixel or 0 to disable full scene AA. This only 492 * The number of samples per pixel or 0 to disable full scene AA. This only
490 * applies if the kRenderTarget_GrTextureFlagBit is set. The actual number 493 * applies if the kRenderTarget_GrSurfaceFlag is set. The actual number
491 * of samples may not exactly match the request. The request will be rounded 494 * of samples may not exactly match the request. The request will be rounded
492 * up to the next supported sample count, or down if it is larger than the 495 * up to the next supported sample count, or down if it is larger than the
493 * max supported count. 496 * max supported count.
494 */ 497 */
495 int fSampleCnt; 498 int fSampleCnt;
496 }; 499 };
497 500
501 // Legacy alias
502 typedef GrSurfaceDesc GrTextureDesc;
503
498 /** 504 /**
499 * GrCacheID is used create and find cached GrResources (e.g. GrTextures). The I D has two parts: 505 * GrCacheID is used create and find cached GrResources (e.g. GrTextures). The I D has two parts:
500 * the domain and the key. Domains simply allow multiple clients to use 0-based indices as their 506 * the domain and the key. Domains simply allow multiple clients to use 0-based indices as their
501 * cache key without colliding. The key uniquely identifies a GrResource within the domain. 507 * cache key without colliding. The key uniquely identifies a GrResource within the domain.
502 * Users of the cache must obtain a domain via GenerateDomain(). 508 * Users of the cache must obtain a domain via GenerateDomain().
503 */ 509 */
504 struct GrCacheID { 510 struct GrCacheID {
505 public: 511 public:
506 typedef uint8_t Domain; 512 typedef uint8_t Domain;
507 513
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 * resolves when it reads from the texture. The client can explictly resolve 584 * resolves when it reads from the texture. The client can explictly resolve
579 * using the GrRenderTarget interface. 585 * using the GrRenderTarget interface.
580 * 586 *
581 * Note: These flags currently form a subset of GrTexture's flags. 587 * Note: These flags currently form a subset of GrTexture's flags.
582 */ 588 */
583 589
584 enum GrBackendTextureFlags { 590 enum GrBackendTextureFlags {
585 /** 591 /**
586 * No flags enabled 592 * No flags enabled
587 */ 593 */
588 kNone_GrBackendTextureFlag = kNone_GrTextureFlags, 594 kNone_GrBackendTextureFlag = 0,
589 /** 595 /**
590 * Indicates that the texture is also a render target, and thus should have 596 * Indicates that the texture is also a render target, and thus should have
591 * a GrRenderTarget object. 597 * a GrRenderTarget object.
592 *
593 * D3D (future): client must have created the texture with flags that allow
594 * it to be used as a render target.
595 */ 598 */
596 kRenderTarget_GrBackendTextureFlag = kRenderTarget_GrTextureFlagBit, 599 kRenderTarget_GrBackendTextureFlag = kRenderTarget_GrSurfaceFlag,
597 }; 600 };
598 GR_MAKE_BITFIELD_OPS(GrBackendTextureFlags) 601 GR_MAKE_BITFIELD_OPS(GrBackendTextureFlags)
599 602
600 struct GrBackendTextureDesc { 603 struct GrBackendTextureDesc {
601 GrBackendTextureDesc() { memset(this, 0, sizeof(*this)); } 604 GrBackendTextureDesc() { memset(this, 0, sizeof(*this)); }
602 GrBackendTextureFlags fFlags; 605 GrBackendTextureFlags fFlags;
603 GrSurfaceOrigin fOrigin; 606 GrSurfaceOrigin fOrigin;
604 int fWidth; //<! width in pixels 607 int fWidth; //<! width in pixels
605 int fHeight; //<! height in pixels 608 int fHeight; //<! height in pixels
606 GrPixelConfig fConfig; //<! color format 609 GrPixelConfig fConfig; //<! color format
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 public: 720 public:
718 GrAutoMalloc() : INHERITED() {} 721 GrAutoMalloc() : INHERITED() {}
719 explicit GrAutoMalloc(size_t size) : INHERITED(size) {} 722 explicit GrAutoMalloc(size_t size) : INHERITED(size) {}
720 virtual ~GrAutoMalloc() {} 723 virtual ~GrAutoMalloc() {}
721 private: 724 private:
722 typedef GrAutoMallocBaseType INHERITED; 725 typedef GrAutoMallocBaseType INHERITED;
723 }; 726 };
724 727
725 #undef GrAutoMallocBaseType 728 #undef GrAutoMallocBaseType
726 #endif 729 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTexture.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698