src/cache/GpuResourceCache.js
function (capacity, lowWater) {
            if (!capacity || capacity < 1) {
                throw new ArgumentError(
                    Logger.logMessage(Logger.LEVEL_SEVERE, "GpuResourceCache", "constructor",
                        "Specified cache capacity is undefined, 0 or negative."));
            }

            if (!lowWater || lowWater < 0 || lowWater >= capacity) {
                throw new ArgumentError(
                    Logger.logMessage(Logger.LEVEL_SEVERE, "GpuResourceCache", "constructor",
                        "Specified cache low-water value is undefined, negative or not less than the capacity."));
            }

            // Private. Holds the actual cache entries.
            this.entries = new MemoryCache(capacity, lowWater);

            // Private. Counter for generating cache keys.
            this.cacheKeyPool = 0;

            // Private. List of retrievals currently in progress.
            this.currentRetrievals = {};

            // Private. Identifies requested resources that whose retrieval failed.
            this.absentResourceList = new AbsentResourceList(3, 60e3);
        }
function (capacity, lowWater) {
            if (!capacity || capacity < 1) {
                throw new ArgumentError(
                    Logger.logMessage(Logger.LEVEL_SEVERE, "GpuResourceCache", "constructor",
                        "Specified cache capacity is undefined, 0 or negative."));
            }

            if (!lowWater || lowWater < 0 || lowWater >= capacity) {
                throw new ArgumentError(
                    Logger.logMessage(Logger.LEVEL_SEVERE, "GpuResourceCache", "constructor",
                        "Specified cache low-water value is undefined, negative or not less than the capacity."));
            }

            // Private. Holds the actual cache entries.
            this.entries = new MemoryCache(capacity, lowWater);

            // Private. Counter for generating cache keys.
            this.cacheKeyPool = 0;

            // Private. List of retrievals currently in progress.
            this.currentRetrievals = {};

            // Private. Identifies requested resources that whose retrieval failed.
            this.absentResourceList = new AbsentResourceList(3, 60e3);
        }
function ( capacity , lowWater ) { if ( ! capacity || capacity < 1 ) { throw new ArgumentError ( Logger . logMessage ( Logger . LEVEL_SEVERE , "GpuResourceCache" , "constructor" , "Specified cache capacity is undefined, 0 or negative." ) ) ; } if ( ! lowWater || lowWater < 0 || lowWater >= capacity ) { throw new ArgumentError ( Logger . logMessage ( Logger . LEVEL_SEVERE , "GpuResourceCache" , "constructor" , "Specified cache low-water value is undefined, negative or not less than the capacity." ) ) ; } // Private. Holds the actual cache entries. this . entries = new MemoryCache ( capacity , lowWater ) ; // Private. Counter for generating cache keys. this . cacheKeyPool = 0 ; // Private. List of retrievals currently in progress. this . currentRetrievals = { } ; // Private. Identifies requested resources that whose retrieval failed. this . absentResourceList = new AbsentResourceList ( 3 , 60e3 ) ; }
Constructs a GPU resource cache for a specified size and low-water value.
@alias GpuResourceCache
@constructor
@classdesc Maintains a cache of GPU resources such as textures and GLSL programs.
Applications typically do not interact with this class unless they create their own shapes.
@param {Number} capacity The cache capacity, in bytes.
@param {Number} lowWater The number of bytes to clear the cache to when it exceeds its capacity.
@throws {ArgumentError} If the specified capacity is undefined, 0 or negative or the low-water value is
undefined, negative or not less than the capacity.
Constructs a GPU resource cache for a specified size and low - water value .