rfm2  22.0
A python-based rewrite of RenderMan for Maya
 All Classes Namespaces Files Functions Variables Pages
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__
 
def shader_param_list
 
def __del__
 
def get
 
def ref_count_incr
 
def ref_count_decr
 
def stats
 

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

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.
def rfm2.vp.pxr_light.Vp2ShaderCache.__del__ (   self)
Release all shader instances when the cache is destroyed.

Member Function Documentation

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:

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:

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:

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:

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

Member Data Documentation

rfm2.vp.pxr_light.Vp2ShaderCache.cache
rfm2.vp.pxr_light.Vp2ShaderCache.shader_desc

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