Flutter Engine
The Flutter Engine
Functions
GrAttachment.cpp File Reference
#include "src/gpu/ganesh/GrAttachment.h"
#include "include/core/SkTextureCompressionType.h"
#include "src/gpu/DataUtils.h"
#include "src/gpu/ganesh/GrBackendUtils.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrDataUtils.h"
#include "src/gpu/ganesh/GrGpu.h"

Go to the source code of this file.

Functions

static void build_key (skgpu::ResourceKey::Builder *builder, const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, GrAttachment::UsageFlags requiredUsage, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, GrMemoryless memoryless)
 

Function Documentation

◆ build_key()

static void build_key ( skgpu::ResourceKey::Builder builder,
const GrCaps caps,
const GrBackendFormat format,
SkISize  dimensions,
GrAttachment::UsageFlags  requiredUsage,
int  sampleCnt,
skgpu::Mipmapped  mipmapped,
GrProtected  isProtected,
GrMemoryless  memoryless 
)
static

Definition at line 38 of file GrAttachment.cpp.

46 {
47 SkASSERT(!dimensions.isEmpty());
48
49 SkASSERT(static_cast<uint32_t>(isProtected) <= 1);
50 SkASSERT(static_cast<uint32_t>(memoryless) <= 1);
51 SkASSERT(static_cast<uint32_t>(requiredUsage) < (1u << 8));
52 SkASSERT(static_cast<uint32_t>(sampleCnt) < (1u << (32 - 10)));
53
54 uint64_t formatKey = caps.computeFormatKey(format);
55 (*builder)[0] = dimensions.width();
56 (*builder)[1] = dimensions.height();
57 (*builder)[2] = formatKey & 0xFFFFFFFF;
58 (*builder)[3] = (formatKey >> 32) & 0xFFFFFFFF;
59 (*builder)[4] = (static_cast<uint32_t>(isProtected) << 0) |
60 (static_cast<uint32_t>(memoryless) << 1) |
61 (static_cast<uint32_t>(requiredUsage) << 2) |
62 (static_cast<uint32_t>(sampleCnt) << 10);
63}
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual uint64_t computeFormatKey(const GrBackendFormat &) const =0
uint32_t uint32_t * format
bool isEmpty() const
Definition: SkSize.h:31
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37