rfm2
22.0
A python-based rewrite of RenderMan for Maya
|
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 | |
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.
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.
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.
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.
def rfm2.vp.pxr_light.Vp2ShaderCache.ref_count_incr | ( | self, | |
key | |||
) |
Increment the ref count for the shader with this key.
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.
def rfm2.vp.pxr_light.Vp2ShaderCache.stats | ( | self | ) |
Print cache contents for debugging.
rfm2.vp.pxr_light.Vp2ShaderCache.cache |
rfm2.vp.pxr_light.Vp2ShaderCache.shader_desc |