Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
skgpu::graphite::UniformDataBlock Class Reference

#include <PipelineData.h>

Public Member Functions

 UniformDataBlock (SkSpan< const char > data)
 
 UniformDataBlock ()=default
 
const char * data () const
 
size_t size () const
 
uint32_t hash () const
 
bool operator== (const UniformDataBlock &that) const
 
bool operator!= (const UniformDataBlock &that) const
 

Static Public Member Functions

static UniformDataBlockMake (const UniformDataBlock &, SkArenaAlloc *)
 

Detailed Description

Definition at line 33 of file PipelineData.h.

Constructor & Destructor Documentation

◆ UniformDataBlock() [1/2]

skgpu::graphite::UniformDataBlock::UniformDataBlock ( SkSpan< const char >  data)
inline

Definition at line 37 of file PipelineData.h.

37: fData(data) {}

◆ UniformDataBlock() [2/2]

skgpu::graphite::UniformDataBlock::UniformDataBlock ( )
default

Member Function Documentation

◆ data()

const char * skgpu::graphite::UniformDataBlock::data ( ) const
inline

Definition at line 40 of file PipelineData.h.

40{ return fData.data(); }
constexpr T * data() const
Definition: SkSpan_impl.h:94

◆ hash()

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

Definition at line 45 of file PipelineData.cpp.

45 {
46 return SkChecksum::Hash32(fData.data(), fData.size());
47}
constexpr size_t size() const
Definition: SkSpan_impl.h:95
uint32_t Hash32(const void *data, size_t bytes, uint32_t seed)
Definition: SkChecksum.cpp:113

◆ Make()

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

Definition at line 35 of file PipelineData.cpp.

35 {
36 static constexpr size_t kUniformAlignment = alignof(void*);
37 char* mem = static_cast<char*>(arena->makeBytesAlignedTo(other.size(), kUniformAlignment));
38 memcpy(mem, other.data(), other.size());
39
40 return arena->make([&](void* ptr) {
41 return new (ptr) UniformDataBlock(SkSpan<const char>(mem, other.size()));
42 });
43}
void * makeBytesAlignedTo(size_t size, size_t align)
Definition: SkArenaAlloc.h:200
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
Definition: SkArenaAlloc.h:120

◆ operator!=()

bool skgpu::graphite::UniformDataBlock::operator!= ( const UniformDataBlock that) const
inline

Definition at line 49 of file PipelineData.h.

49{ return !(*this == that); }

◆ operator==()

bool skgpu::graphite::UniformDataBlock::operator== ( const UniformDataBlock that) const
inline

Definition at line 45 of file PipelineData.h.

45 {
46 return fData.size() == that.fData.size() &&
47 !memcmp(fData.data(), that.fData.data(), fData.size());
48 }

◆ size()

size_t skgpu::graphite::UniformDataBlock::size ( ) const
inline

Definition at line 41 of file PipelineData.h.

41{ return fData.size(); }

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