Go to the source code of this file.
|
| static int | vkd3d_shader_cache_compare_key (const void *key, const struct rb_entry *entry) |
| |
| static void | vkd3d_shader_cache_add_entry (struct vkd3d_shader_cache *cache, struct shader_cache_entry *e) |
| |
| int | vkd3d_shader_open_cache (struct vkd3d_shader_cache **cache) |
| |
| unsigned int | vkd3d_shader_cache_incref (struct vkd3d_shader_cache *cache) |
| |
| static void | vkd3d_shader_cache_destroy_entry (struct rb_entry *entry, void *context) |
| |
| unsigned int | vkd3d_shader_cache_decref (struct vkd3d_shader_cache *cache) |
| |
| static uint64_t | vkd3d_shader_cache_hash_key (const void *key, size_t size) |
| |
| static void | vkd3d_shader_cache_lock (struct vkd3d_shader_cache *cache) |
| |
| static void | vkd3d_shader_cache_unlock (struct vkd3d_shader_cache *cache) |
| |
| int | vkd3d_shader_cache_put (struct vkd3d_shader_cache *cache, const void *key, size_t key_size, const void *value, size_t value_size) |
| |
| int | vkd3d_shader_cache_get (struct vkd3d_shader_cache *cache, const void *key, size_t key_size, void *value, size_t *value_size) |
| |
◆ vkd3d_shader_cache_add_entry()
Definition at line 69 of file cache.c.
71{
73 {
75 .key_size =
e->h.key_size,
77 };
78
80}
static int rb_put(struct rb_tree *tree, const void *key, struct rb_entry *entry)
Referenced by vkd3d_shader_cache_put().
◆ vkd3d_shader_cache_compare_key()
Definition at line 50 of file cache.c.
51{
55
60
61
62
63
65 FIXME(
"Actual case of a hash collision found.\n");
67}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
#define RB_ENTRY_VALUE(element, type, field)
static int vkd3d_u64_compare(uint64_t x, uint64_t y)
Referenced by vkd3d_shader_open_cache().
◆ vkd3d_shader_cache_decref()
Definition at line 115 of file cache.c.
116{
118 TRACE(
"cache %p refcount %u.\n",
cache, refcount);
119
120 if (refcount)
121 return refcount;
122
125
127 return 0;
128}
static void rb_destroy(struct rb_tree *tree, rb_traverse_func_t *callback, void *context)
static void vkd3d_shader_cache_destroy_entry(struct rb_entry *entry, void *context)
static void vkd3d_mutex_destroy(struct vkd3d_mutex *lock)
static uint32_t vkd3d_atomic_decrement_u32(uint32_t volatile *x)
static void vkd3d_free(void *ptr)
Referenced by d3d12_cache_session_destroy().
◆ vkd3d_shader_cache_destroy_entry()
◆ vkd3d_shader_cache_get()
Definition at line 208 of file cache.c.
210{
215 size_t size_in;
216
218
219 size_in = *value_size;
220
223 k.key_size = key_size;
224
226
229 {
230 WARN(
"Entry not found.\n");
232 goto done;
233 }
234
236
237 *value_size =
e->h.value_size;
239 {
241 e->h.hash,
e->h.value_size);
243 goto done;
244 }
245
246 if (size_in < e->
h.value_size)
247 {
248 WARN(
"Output buffer is too small for item %#"PRIx64", got %#zx want %#"PRIx64".\n",
249 e->h.hash, size_in,
e->h.value_size);
251 goto done;
252 }
253
256 TRACE(
"Returning cached item %#"PRIx64".\n",
e->h.hash);
257
258done:
261}
GLfloat GLfloat GLfloat GLfloat h
#define memcpy(s1, s2, n)
static struct rb_entry * rb_get(const struct rb_tree *tree, const void *key)
static uint64_t vkd3d_shader_cache_hash_key(const void *key, size_t size)
static void vkd3d_shader_cache_lock(struct vkd3d_shader_cache *cache)
static void vkd3d_shader_cache_unlock(struct vkd3d_shader_cache *cache)
Referenced by d3d12_cache_session_FindValue().
◆ vkd3d_shader_cache_hash_key()
Definition at line 130 of file cache.c.
131{
132 static const uint64_t fnv_prime = 0x00000100000001b3;
136
139
141}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Referenced by vkd3d_shader_cache_get(), and vkd3d_shader_cache_put().
◆ vkd3d_shader_cache_incref()
Definition at line 101 of file cache.c.
102{
104 TRACE(
"cache %p refcount %u.\n",
cache, refcount);
105 return refcount;
106}
static uint32_t vkd3d_atomic_increment_u32(uint32_t volatile *x)
Referenced by d3d12_cache_session_init().
◆ vkd3d_shader_cache_lock()
◆ vkd3d_shader_cache_put()
Definition at line 153 of file cache.c.
155{
160
162
165 k.key_size = key_size;
166
168
171
173 {
174 WARN(
"Key already exists, returning VKD3D_ERROR_KEY_ALREADY_EXISTS.\n");
176 goto done;
177 }
178
181 {
183 goto done;
184 }
187 {
190 goto done;
191 }
192
193 e->h.key_size = key_size;
194 e->h.value_size = value_size;
198
202
203done:
206}
static void vkd3d_shader_cache_add_entry(struct vkd3d_shader_cache *cache, struct shader_cache_entry *e)
static void * vkd3d_malloc(size_t size)
@ VKD3D_ERROR_KEY_ALREADY_EXISTS
@ VKD3D_ERROR_OUT_OF_MEMORY
Referenced by d3d12_cache_session_StoreValue().
◆ vkd3d_shader_cache_unlock()
◆ vkd3d_shader_open_cache()
Definition at line 82 of file cache.c.
83{
85
87
89 if (!object)
91
92 object->refcount = 1;
95
97
99}
static void rb_init(struct rb_tree *tree, rb_compare_func_t compare)
static int vkd3d_shader_cache_compare_key(const void *key, const struct rb_entry *entry)
static void vkd3d_mutex_init(struct vkd3d_mutex *lock)
Referenced by d3d12_cache_session_init().