11 #ifndef __CE_RampCache__
12 #define __CE_RampCache__
38 myTupleSize = tuplesize;
39 myRampSize = rampsize;
42 myHash = myRamp.get() ? myRamp->hash() : 0;
43 SYShashCombine(myHash, myTupleSize);
44 SYShashCombine(myHash, myRampSize);
50 nbytes *= myTupleSize;
58 if (myHash != from.myHash)
return false;
59 if (myTupleSize != from.myTupleSize)
return false;
60 if (myRampSize != from.myRampSize)
return false;
61 if (from.myRamp.get() != myRamp.get())
63 if (!from.myRamp.get() || !myRamp.get())
66 if (*from.myRamp != *myRamp)
120 myNumBytes = numbytes;
124 myNumBytes =
b.myNumBytes;
125 myBuffer = std::move(
b.myBuffer);
132 myNumBytes =
b.myNumBytes;
133 myBuffer = std::move(
b.myBuffer);
140 void destroyBuffers();
150 exint myNumBytes = 0;
159 void getUsage(
exint& total,
exint& not_in_use)
const;
172 const char*
name()
const override
174 return "OpenCL Ramp Cache";
182 freed_amount = myRampCache.freeMemory(amount);
183 return freed_amount > 0;
187 exint& cache)
override
189 myRampCache.getUsage(in_use, cache);
200 mutable UT_Lock myRampCacheLock;
203 MemoryClient myMemoryClient;
std::size_t SYS_HashType
Define the type for hash values.
MemoryClient(CE_RampCache &cache)
RampEntry(cl::Buffer buffer, exint numbytes)
bool freeMemoryRequest(const UT_MemoryResource *resource, RequestSeverity severity, Niceness niceness, exint amount, exint &freed_amount) override
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
CE_API CE_RampCache * CEgetRampCache()
GLboolean GLboolean GLboolean b
RampEntry & operator=(RampEntry &&b)
bool operator==(const CE_RampKey &from) const
This class implements a pool for UT_Ramps on the GPU.
std::size_t operator()(const CE_RampKey &key) const noexcept
SYS_HashType hash() const
IMATH_NAMESPACE::V2f IMATH_NAMESPACE::Box2i std::string this attribute is obsolete as of OpenEXR v3 float
cl::Buffer buffer() const
CE_RampKey(UT_SharedPtr< UT_Ramp > ramp, int tuplesize, int rampsize)
static exint computeNumBytes(const RampEntry &entry)
Niceness
How willingly a client can free memory for other clients.
bool memoryUse(const UT_MemoryResource *resource, exint &in_use, exint &cache) override
Wrapper for a client of a limit memory resource.
RequestSeverity
The urgency of the memory free request.
const char * name() const override
Printable English name of the client.
size_t hash_value(const CH_ChannelRef &ref)