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

#include <DawnSampler.h>

Inheritance diagram for skgpu::graphite::DawnSampler:
skgpu::graphite::Sampler skgpu::graphite::Resource

Public Member Functions

 ~DawnSampler () override
 
const wgpu::Sampler & dawnSampler () const
 
- Public Member Functions inherited from skgpu::graphite::Sampler
 ~Sampler () override
 
const char * getResourceType () const override
 
- Public Member Functions inherited from skgpu::graphite::Resource
 Resource (const Resource &)=delete
 
 Resource (Resource &&)=delete
 
Resourceoperator= (const Resource &)=delete
 
Resourceoperator= (Resource &&)=delete
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
Ownership ownership () const
 
skgpu::Budgeted budgeted () const
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
virtual const char * getResourceType () const =0
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
bool wasDestroyed () const
 
const GraphiteResourceKeykey () const
 
void setKey (const GraphiteResourceKey &key)
 
void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual void prepareForReturnToCache (const std::function< void()> &takeRef)
 

Static Public Member Functions

static sk_sp< DawnSamplerMake (const DawnSharedContext *, const SkSamplingOptions &samplingOptions, SkTileMode xTileMode, SkTileMode yTileMode)
 

Additional Inherited Members

- Protected Member Functions inherited from skgpu::graphite::Sampler
 Sampler (const SharedContext *)
 
- Protected Member Functions inherited from skgpu::graphite::Resource
 Resource (const SharedContext *, Ownership, skgpu::Budgeted, size_t gpuMemorySize, bool commandBufferRefsAsUsageRefs=false)
 
virtual ~Resource ()
 
const SharedContextsharedContext () const
 
virtual void onDumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump, const char *dumpName) const
 
void setDeleteASAP ()
 

Detailed Description

Definition at line 22 of file DawnSampler.h.

Constructor & Destructor Documentation

◆ ~DawnSampler()

skgpu::graphite::DawnSampler::~DawnSampler ( )
inlineoverride

Definition at line 28 of file DawnSampler.h.

28{}

Member Function Documentation

◆ dawnSampler()

const wgpu::Sampler & skgpu::graphite::DawnSampler::dawnSampler ( ) const
inline

Definition at line 30 of file DawnSampler.h.

30{ return fSampler; }

◆ Make()

sk_sp< DawnSampler > skgpu::graphite::DawnSampler::Make ( const DawnSharedContext sharedContext,
const SkSamplingOptions samplingOptions,
SkTileMode  xTileMode,
SkTileMode  yTileMode 
)
static

Definition at line 64 of file DawnSampler.cpp.

67 {
68 wgpu::SamplerDescriptor desc;
69 desc.addressModeU = tile_mode_to_dawn_address_mode(xTileMode);
70 desc.addressModeV = tile_mode_to_dawn_address_mode(yTileMode);
71 desc.magFilter = filter_mode_to_dawn_filter_mode(samplingOptions.filter);
72 desc.minFilter = desc.magFilter;
73 desc.mipmapFilter = mipmap_mode_to_dawn_filter_mode(samplingOptions.mipmap);
74 desc.lodMinClamp = 0.0f;
75 if (samplingOptions.mipmap == SkMipmapMode::kNone) {
76 // Disabling mipmap by clamping max lod to first level only.
77 desc.lodMaxClamp = 0.0f;
78 } else {
79 desc.lodMaxClamp = FLT_MAX;
80 }
81 desc.maxAnisotropy = 1;
82 desc.compare = wgpu::CompareFunction::Undefined;
83
84 std::string label;
86 static const char* tileModeLabels[] = {"Clamp", "Repeat", "Mirror", "Decal"};
87 static const char* minMagFilterLabels[] = {"Nearest", "Linear"};
88 static const char* mipFilterLabels[] = {"MipNone", "MipNearest", "MipLinear"};
89 label.append("X").append(tileModeLabels[static_cast<int>(xTileMode)]);
90 label.append("Y").append(tileModeLabels[static_cast<int>(yTileMode)]);
91 label.append(minMagFilterLabels[static_cast<int>(samplingOptions.filter)]);
92 label.append(mipFilterLabels[static_cast<int>(samplingOptions.mipmap)]);
93 desc.label = label.c_str();
94 }
95
96 auto sampler = sharedContext->device().CreateSampler(&desc);
97 if (!sampler) {
98 return {};
99 }
100 return sk_sp<DawnSampler>(new DawnSampler(sharedContext, std::move(sampler)));
101}
bool setBackendLabels() const
Definition: Caps.h:297
const SharedContext * sharedContext() const
Definition: Resource.h:189
const Caps * caps() const
Definition: SharedContext.h:39
static wgpu::AddressMode tile_mode_to_dawn_address_mode(SkTileMode tileMode)
Definition: DawnSampler.cpp:49
const SkFilterMode filter
const SkMipmapMode mipmap

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