Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 (const SkSamplingOptions &sampling, const SkTileMode tileModes[2], sk_sp< TextureProxy > proxy)
 
void reset ()
 

Static Public Member Functions

static TextureDataBlockMake (const TextureDataBlock &, SkArenaAlloc *)
 

Detailed Description

Definition at line 52 of file PipelineData.h.

Member Typedef Documentation

◆ SampledTexture

Definition at line 54 of file PipelineData.h.

Constructor & Destructor Documentation

◆ TextureDataBlock()

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

Member Function Documentation

◆ add()

void skgpu::graphite::TextureDataBlock::add ( const SkSamplingOptions sampling,
const SkTileMode  tileModes[2],
sk_sp< TextureProxy proxy 
)
inline

Definition at line 67 of file PipelineData.h.

69 {
70 fTextureData.push_back({std::move(proxy), SamplerDesc{sampling, tileModes}});
71 }
SkSamplingOptions sampling
Definition SkRecords.h:337

◆ empty()

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

Definition at line 59 of file PipelineData.h.

59{ return fTextureData.empty(); }

◆ hash()

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

Definition at line 70 of file PipelineData.cpp.

70 {
71 uint32_t hash = 0;
72
73 for (auto& d : fTextureData) {
74 SamplerDesc samplerKey = std::get<1>(d);
75 hash = SkChecksum::Hash32(&samplerKey, sizeof(samplerKey), hash);
76
77 // Because the lifetime of the TextureDataCache is for just one Recording and the
78 // TextureDataBlocks hold refs on their proxies, we can just use the proxy's pointer
79 // for the hash here.
80 uintptr_t proxy = reinterpret_cast<uintptr_t>(std::get<0>(d).get());
81 hash = SkChecksum::Hash32(&proxy, sizeof(proxy), hash);
82 }
83
84 return hash;
85}
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)

◆ Make()

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

Definition at line 49 of file PipelineData.cpp.

50 {
51 return arena->make([&](void *ptr) {
52 return new (ptr) TextureDataBlock(other);
53 });
54}
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))

◆ numTextures()

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

Definition at line 60 of file PipelineData.h.

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

◆ operator!=()

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

Definition at line 64 of file PipelineData.h.

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

◆ operator==()

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

Definition at line 56 of file PipelineData.cpp.

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

◆ reset()

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

Definition at line 73 of file PipelineData.h.

73 {
74 fTextureData.clear();
75 }

◆ texture()

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

Definition at line 61 of file PipelineData.h.

61{ return fTextureData[index]; }

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