rfm2  22.0
A python-based rewrite of RenderMan for Maya
rfm2.vp.pxr_light.Vp2ShaderCache Class Reference
+ Inheritance diagram for rfm2.vp.pxr_light.Vp2ShaderCache:
+ Collaboration diagram for rfm2.vp.pxr_light.Vp2ShaderCache:

Public Member Functions

def __init__ (self)
 
def shader_param_list (self, shader_name)
 
def __del__ (self)
 
def get (self, old_key, **kw)
 
def ref_count_incr (self, key)
 
def ref_count_decr (self, key)
 
def stats (self)
 

Public Attributes

 cache
 
 shader_desc
 

Detailed Description

Because VP2 is consolidating render items with matching VB and shader
instance, we implement a simple shader instance cache.
This class will maintain a dict of shader instance with their ref count.
The key is the input parameters.
If a shader instance for a given color already exists, it will return it.
Otherwise, a new shader instance with that color will be created, cached
and returned.

Constructor & Destructor Documentation

◆ __init__()

def rfm2.vp.pxr_light.Vp2ShaderCache.__init__ (   self)
Create the cache. We also cache parameter lists per shaders to be
able to safely set their values.

◆ __del__()

def rfm2.vp.pxr_light.Vp2ShaderCache.__del__ (   self)
Release all shader instances when the cache is destroyed.

Member Function Documentation

◆ get()

def rfm2.vp.pxr_light.Vp2ShaderCache.get (   self,
  old_key,
**  kw 
)
Return a shader instance using the requested color. We create new
instances on demand and cache them for re-use.
The instances are reference-counted and will be deleted when needed.
+ Here is the call graph for this function:

◆ ref_count_decr()

def rfm2.vp.pxr_light.Vp2ShaderCache.ref_count_decr (   self,
  key 
)
Decrement the ref count for the shader with this key.
If the ref count drops below 1, we release the MShaderInstance and
delete the cache entry.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ref_count_incr()

def rfm2.vp.pxr_light.Vp2ShaderCache.ref_count_incr (   self,
  key 
)
Increment the ref count for the shader with this key.
+ Here is the caller graph for this function:

◆ shader_param_list()

def rfm2.vp.pxr_light.Vp2ShaderCache.shader_param_list (   self,
  shader_name 
)
Return the shader parameter list and lazily fill the cached shader
param list on cache miss.
+ Here is the caller graph for this function:

◆ stats()

def rfm2.vp.pxr_light.Vp2ShaderCache.stats (   self)
Print cache contents for debugging.

Member Data Documentation

◆ cache

rfm2.vp.pxr_light.Vp2ShaderCache.cache

◆ shader_desc

rfm2.vp.pxr_light.Vp2ShaderCache.shader_desc

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