mesa: Rename MESA_shader_framebuffer_fetch gl_extensions bits to EXT.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_program_cache.c
index adb0cd5a23b744288cc53a4f0eafd5112a52c52c..14c356db321a4595e36fdfe1101cb14ca2aee805 100644 (file)
@@ -69,7 +69,7 @@ struct brw_cache_item {
 
    /** for variable-sized keys */
    GLuint key_size;
-   GLuint aux_size;
+   GLuint prog_data_size;
    const void *key;
 
    uint32_t offset;
@@ -182,7 +182,7 @@ bool
 brw_search_cache(struct brw_cache *cache,
                  enum brw_cache_id cache_id,
                  const void *key, GLuint key_size,
-                 uint32_t *inout_offset, void *inout_aux)
+                 uint32_t *inout_offset, void *inout_prog_data)
 {
    struct brw_context *brw = cache->brw;
    struct brw_cache_item *item;
@@ -200,12 +200,13 @@ brw_search_cache(struct brw_cache *cache,
    if (item == NULL)
       return false;
 
-   void *aux = ((char *) item->key) + item->key_size;
+   void *prog_data = ((char *) item->key) + item->key_size;
 
-   if (item->offset != *inout_offset || aux != *((void **) inout_aux)) {
+   if (item->offset != *inout_offset ||
+       prog_data != *((void **) inout_prog_data)) {
       brw->ctx.NewDriverState |= (1 << cache_id);
       *inout_offset = item->offset;
-      *((void **) inout_aux) = aux;
+      *((void **) inout_prog_data) = prog_data;
    }
 
    return true;
@@ -320,10 +321,10 @@ brw_upload_cache(struct brw_cache *cache,
                  GLuint key_size,
                  const void *data,
                  GLuint data_size,
-                 const void *aux,
-                 GLuint aux_size,
+                 const void *prog_data,
+                 GLuint prog_data_size,
                  uint32_t *out_offset,
-                 void *out_aux)
+                 void *out_prog_data)
 {
    struct brw_cache_item *item = CALLOC_STRUCT(brw_cache_item);
    const struct brw_cache_item *matching_data =
@@ -335,7 +336,7 @@ brw_upload_cache(struct brw_cache *cache,
    item->size = data_size;
    item->key = key;
    item->key_size = key_size;
-   item->aux_size = aux_size;
+   item->prog_data_size = prog_data_size;
    hash = hash_key(item);
    item->hash = hash;
 
@@ -354,11 +355,11 @@ brw_upload_cache(struct brw_cache *cache,
       memcpy(cache->map + item->offset, data, data_size);
    }
 
-   /* Set up the memory containing the key and aux_data */
-   tmp = malloc(key_size + aux_size);
+   /* Set up the memory containing the key and prog_data */
+   tmp = malloc(key_size + prog_data_size);
 
    memcpy(tmp, key, key_size);
-   memcpy(tmp + key_size, aux, aux_size);
+   memcpy(tmp + key_size, prog_data, prog_data_size);
 
    item->key = tmp;
 
@@ -371,7 +372,7 @@ brw_upload_cache(struct brw_cache *cache,
    cache->n_items++;
 
    *out_offset = item->offset;
-   *(void **)out_aux = (void *)((char *)item->key + item->key_size);
+   *(void **)out_prog_data = (void *)((char *)item->key + item->key_size);
    cache->brw->ctx.NewDriverState |= 1 << cache_id;
 }
 
@@ -412,8 +413,8 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
              c->cache_id == BRW_CACHE_GS_PROG ||
              c->cache_id == BRW_CACHE_FS_PROG ||
              c->cache_id == BRW_CACHE_CS_PROG) {
-            const void *item_aux = c->key + c->key_size;
-            brw_stage_prog_data_free(item_aux);
+            const void *item_prog_data = c->key + c->key_size;
+            brw_stage_prog_data_free(item_prog_data);
          }
          free((void *)c->key);
          free(c);
@@ -459,6 +460,7 @@ brw_program_cache_check_size(struct brw_context *brw)
       perf_debug("Exceeded state cache size limit.  Clearing the set "
                  "of compiled programs, which will trigger recompiles\n");
       brw_clear_cache(brw, &brw->cache);
+      brw_cache_new_bo(&brw->cache, brw->cache.bo->size);
    }
 }