Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skgpu::graphite::SamplerDesc Struct Reference

#include <ResourceTypes.h>

Public Member Functions

 SamplerDesc (const SkSamplingOptions &samplingOptions, const SkTileMode tileModes[2])
 
 SamplerDesc (const SamplerDesc &)=default
 
bool operator== (const SamplerDesc &o) const
 
bool operator!= (const SamplerDesc &o) const
 
SkTileMode tileModeX () const
 
SkTileMode tileModeY () const
 
uint32_t desc () const
 
SkSamplingOptions samplingOptions () const
 

Detailed Description

Struct used to describe how a Texture/TextureProxy/TextureProxyView is sampled.

Definition at line 201 of file ResourceTypes.h.

Constructor & Destructor Documentation

◆ SamplerDesc() [1/2]

skgpu::graphite::SamplerDesc::SamplerDesc ( const SkSamplingOptions samplingOptions,
const SkTileMode  tileModes[2] 
)
inline

Definition at line 203 of file ResourceTypes.h.

204 : fDesc((static_cast<int>(tileModes[0]) << kTileModeXShift) |
205 (static_cast<int>(tileModes[1]) << kTileModeYShift) |
206 (static_cast<int>(samplingOptions.filter) << kFilterModeShift) |
207 (static_cast<int>(samplingOptions.mipmap) << kMipmapModeShift) ) {
208 // Cubic sampling is handled in a shader, with the actual texture sampled by with NN,
209 // but that is what a cubic SkSamplingOptions is set to if you ignore 'cubic', which let's
210 // us simplify how we construct SamplerDec's from the options passed to high-level draws.
213 static_assert(kMipmapModeShift + kNumMipmapModeBits <= 32);
214 // Backend-agnostic sampler information can fit within one uint32_t.
215 // TODO: Add aniso value when used.
216 static_assert(sizeof(uint32_t) == 4);
217 }
#define SkASSERT(cond)
Definition SkAssert.h:116
const SkFilterMode filter
const SkMipmapMode mipmap
SkSamplingOptions samplingOptions() const

◆ SamplerDesc() [2/2]

skgpu::graphite::SamplerDesc::SamplerDesc ( const SamplerDesc )
default

Member Function Documentation

◆ desc()

uint32_t skgpu::graphite::SamplerDesc::desc ( ) const
inline

Definition at line 226 of file ResourceTypes.h.

226{ return fDesc; }

◆ operator!=()

bool skgpu::graphite::SamplerDesc::operator!= ( const SamplerDesc o) const
inline

Definition at line 222 of file ResourceTypes.h.

222{ return o.fDesc != fDesc; }

◆ operator==()

bool skgpu::graphite::SamplerDesc::operator== ( const SamplerDesc o) const
inline

Definition at line 221 of file ResourceTypes.h.

221{ return o.fDesc == fDesc; }

◆ samplingOptions()

SkSamplingOptions skgpu::graphite::SamplerDesc::samplingOptions ( ) const
inline

Definition at line 230 of file ResourceTypes.h.

230 {
231 // TODO: Add support for anisotropic filtering
232 SkFilterMode filter = static_cast<SkFilterMode>((fDesc >> 4) & 0b01);
233 SkMipmapMode mipmap = static_cast<SkMipmapMode>((fDesc >> 5) & 0b11);
234 return SkSamplingOptions(filter, mipmap);
235 }
SkFilterMode
SkMipmapMode

◆ tileModeX()

SkTileMode skgpu::graphite::SamplerDesc::tileModeX ( ) const
inline

Definition at line 224 of file ResourceTypes.h.

224{ return static_cast<SkTileMode>((fDesc >> 0) & 0b11); }
SkTileMode
Definition SkTileMode.h:13

◆ tileModeY()

SkTileMode skgpu::graphite::SamplerDesc::tileModeY ( ) const
inline

Definition at line 225 of file ResourceTypes.h.

225{ return static_cast<SkTileMode>((fDesc >> 2) & 0b11); }

The documentation for this struct was generated from the following file: