Path: blob/21.2-virgl/src/gallium/auxiliary/translate/translate_cache.h
4565 views
/*1* Copyright 2008 VMware, Inc.2* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* on the rights to use, copy, modify, merge, publish, distribute, sub8* license, and/or sell copies of the Software, and to permit persons to whom9* the Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice (including the next12* paragraph) shall be included in all copies or substantial portions of the13* Software.14*15* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL18* VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,19* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR20* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE21* USE OR OTHER DEALINGS IN THE SOFTWARE.22*/23#ifndef _TRANSLATE_CACHE_H24#define _TRANSLATE_CACHE_H252627/*******************************************************************************28* Translate cache.29* Simply used to cache created translates. Avoids unecessary creation of30* translate's if one suitable for a given translate_key has already been31* created.32*33* Note: this functionality depends and requires the CSO module.34*/35struct translate_cache;3637struct translate_key;38struct translate;3940struct translate_cache *translate_cache_create( void );41void translate_cache_destroy(struct translate_cache *cache);4243/**44* Will try to find a translate structure matched by the given key.45* If such a structure doesn't exist in the cache the function46* will automatically create it, insert it in the cache and47* return the created version.48*49*/50struct translate *translate_cache_find(struct translate_cache *cache,51struct translate_key *key);5253#endif545556