Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
skgpu::graphite::TextureDataBlock Class Reference

#include <PipelineData.h>

Public Types

using SampledTexture = std::pair< sk_sp< TextureProxy >, SamplerDesc >
 

Public Member Functions

 TextureDataBlock ()=default
 
bool empty () const
 
int numTextures () const
 
const SampledTexturetexture (int index) const
 
bool operator== (const TextureDataBlock &) const
 
bool operator!= (const TextureDataBlock &other) const
 
uint32_t hash () const
 
void add (sk_sp< TextureProxy > proxy, const SamplerDesc &samplerDesc)
 
void reset ()
 

Static Public Member Functions

static TextureDataBlockMake (const TextureDataBlock &, SkArenaAlloc *)
 

Detailed Description

Definition at line 55 of file PipelineData.h.

Member Typedef Documentation

◆ SampledTexture

Definition at line 57 of file PipelineData.h.

Constructor & Destructor Documentation

◆ TextureDataBlock()

skgpu::graphite::TextureDataBlock::TextureDataBlock ( )
default

Member Function Documentation

◆ add()

void skgpu::graphite::TextureDataBlock::add ( sk_sp< TextureProxy proxy,
const SamplerDesc samplerDesc 
)
inline

Definition at line 70 of file PipelineData.h.

70 {
71 fTextureData.push_back({std::move(proxy), samplerDesc});
72 }

◆ empty()

bool skgpu::graphite::TextureDataBlock::empty ( ) const
inline

Definition at line 62 of file PipelineData.h.

62{ return fTextureData.empty(); }

◆ hash()

uint32_t skgpu::graphite::TextureDataBlock::hash ( ) const

Definition at line 71 of file PipelineData.cpp.

71 {
72 uint32_t hash = 0;
73
74 for (auto& d : fTextureData) {
75 SamplerDesc samplerKey = std::get<1>(d);
76 hash = SkChecksum::Hash32(&samplerKey, sizeof(samplerKey), hash);
77
78 // Because the lifetime of the TextureDataCache is for just one Recording and the
79 // TextureDataBlocks hold refs on their proxies, we can just use the proxy's pointer
80 // for the hash here.
81 uintptr_t proxy = reinterpret_cast<uintptr_t>(std::get<0>(d).get());
82 hash = SkChecksum::Hash32(&proxy, sizeof(proxy), hash);
83 }
84
85 return hash;
86}
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
uint32_t Hash32(const void *data, size_t bytes, uint32_t seed)
Definition: SkChecksum.cpp:113
const myers::Point & get< 1 >(const myers::Segment &s)
Definition: Myers.h:81
const myers::Point & get< 0 >(const myers::Segment &s)
Definition: Myers.h:80

◆ Make()

TextureDataBlock * skgpu::graphite::TextureDataBlock::Make ( const TextureDataBlock other,
SkArenaAlloc arena 
)
static

Definition at line 50 of file PipelineData.cpp.

51 {
52 return arena->make([&](void *ptr) {
53 return new (ptr) TextureDataBlock(other);
54 });
55}
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
Definition: SkArenaAlloc.h:120

◆ numTextures()

int skgpu::graphite::TextureDataBlock::numTextures ( ) const
inline

Definition at line 63 of file PipelineData.h.

63{ return SkTo<int>(fTextureData.size()); }

◆ operator!=()

bool skgpu::graphite::TextureDataBlock::operator!= ( const TextureDataBlock other) const
inline

Definition at line 67 of file PipelineData.h.

67{ return !(*this == other); }

◆ operator==()

bool skgpu::graphite::TextureDataBlock::operator== ( const TextureDataBlock other) const

Definition at line 57 of file PipelineData.cpp.

57 {
58 if (fTextureData.size() != other.fTextureData.size()) {
59 return false;
60 }
61
62 for (size_t i = 0; i < fTextureData.size(); ++i) {
63 if (fTextureData[i] != other.fTextureData[i]) {
64 return false;
65 }
66 }
67
68 return true;
69}

◆ reset()

void skgpu::graphite::TextureDataBlock::reset ( )
inline

Definition at line 74 of file PipelineData.h.

74 {
75 fTextureData.clear();
76 }

◆ texture()

const SampledTexture & skgpu::graphite::TextureDataBlock::texture ( int  index) const
inline

Definition at line 64 of file PipelineData.h.

64{ return fTextureData[index]; }

The documentation for this class was generated from the following files: