mesa: add a isGenName parameter to _mesa_HashInsert
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 4 Sep 2020 12:07:04 +0000 (14:07 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 10 Sep 2020 07:07:11 +0000 (09:07 +0200)
Indicates if the given name has been returned by _mesa_HashFindFreeKeyBlock.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600>

19 files changed:
src/mesa/main/arbprogram.c
src/mesa/main/arrayobj.c
src/mesa/main/atifragshader.c
src/mesa/main/bufferobj.c
src/mesa/main/dlist.c
src/mesa/main/externalobjects.c
src/mesa/main/fbobject.c
src/mesa/main/glthread_varray.c
src/mesa/main/hash.c
src/mesa/main/hash.h
src/mesa/main/performance_monitor.c
src/mesa/main/performance_query.c
src/mesa/main/pipelineobj.c
src/mesa/main/queryobj.c
src/mesa/main/samplerobj.c
src/mesa/main/shaderapi.c
src/mesa/main/teximage.c
src/mesa/main/texobj.c
src/mesa/main/transformfeedback.c

index e6fb7ca..b8e3aad 100644 (file)
@@ -76,6 +76,7 @@ lookup_or_create_program(GLuint id, GLenum target, const char* caller)
       /* Bind a user program */
       newProg = _mesa_lookup_program(ctx, id);
       if (!newProg || newProg == &_mesa_DummyProgram) {
+         bool isGenName = newProg != NULL;
          /* allocate a new program now */
          newProg = ctx->Driver.NewProgram(ctx, _mesa_program_enum_to_shader_stage(target),
                                           id, true);
@@ -83,7 +84,7 @@ lookup_or_create_program(GLuint id, GLenum target, const char* caller)
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
             return NULL;
          }
-         _mesa_HashInsert(ctx->Shared->Programs, id, newProg);
+         _mesa_HashInsert(ctx->Shared->Programs, id, newProg, isGenName);
       }
       else if (newProg->Target != target) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
@@ -235,7 +236,7 @@ _mesa_GenProgramsARB(GLsizei n, GLuint *ids)
    /* Insert pointer to dummy program as placeholder */
    for (i = 0; i < (GLuint) n; i++) {
       _mesa_HashInsertLocked(ctx->Shared->Programs, first + i,
-                             &_mesa_DummyProgram);
+                             &_mesa_DummyProgram, true);
    }
 
    _mesa_HashUnlockMutex(ctx->Shared->Programs);
index a4c15cf..6ac122d 100644 (file)
@@ -1132,7 +1132,7 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
          return;
       }
       obj->EverBound = create;
-      _mesa_HashInsertLocked(ctx->Array.Objects, obj->Name, obj);
+      _mesa_HashInsertLocked(ctx->Array.Objects, obj->Name, obj, true);
       arrays[i] = first + i;
    }
 }
index 44f6bb4..aff4c6e 100644 (file)
@@ -205,7 +205,7 @@ _mesa_GenFragmentShadersATI(GLuint range)
 
    first = _mesa_HashFindFreeKeyBlock(ctx->Shared->ATIShaders, range);
    for (i = 0; i < range; i++) {
-      _mesa_HashInsertLocked(ctx->Shared->ATIShaders, first + i, &DummyShader);
+      _mesa_HashInsertLocked(ctx->Shared->ATIShaders, first + i, &DummyShader, true);
    }
 
    _mesa_HashUnlockMutex(ctx->Shared->ATIShaders);
@@ -244,8 +244,10 @@ _mesa_BindFragmentShaderATI(GLuint id)
       newProg = ctx->Shared->DefaultFragmentShader;
    }
    else {
+      bool isGenName;
       newProg = (struct ati_fragment_shader *)
          _mesa_HashLookup(ctx->Shared->ATIShaders, id);
+      isGenName = newProg != NULL;
       if (!newProg || newProg == &DummyShader) {
         /* allocate a new program now */
         newProg = _mesa_new_ati_fragment_shader(ctx, id);
@@ -253,7 +255,7 @@ _mesa_BindFragmentShaderATI(GLuint id)
            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI");
            return;
         }
-        _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg);
+        _mesa_HashInsert(ctx->Shared->ATIShaders, id, newProg, isGenName);
       }
 
    }
index db5fdaf..67eb9a4 100644 (file)
@@ -966,13 +966,12 @@ _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
       /* If this is a new buffer object id, or one which was generated but
        * never used before, allocate a buffer object now.
        */
-      buf = ctx->Driver.NewBufferObject(ctx, buffer);
-      if (!buf) {
+      *buf_handle = ctx->Driver.NewBufferObject(ctx, buffer);
+      if (!*buf_handle) {
         _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
         return false;
       }
-      _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, buf);
-      *buf_handle = buf;
+      _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, *buf_handle, buf != NULL);
    }
 
    return true;
@@ -1653,7 +1652,7 @@ create_buffers(struct gl_context *ctx, GLsizei n, GLuint *buffers, bool dsa)
       else
          buf = &DummyBufferObject;
 
-      _mesa_HashInsertLocked(ctx->Shared->BufferObjects, buffers[i], buf);
+      _mesa_HashInsertLocked(ctx->Shared->BufferObjects, buffers[i], buf, true);
    }
 
    _mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
index a780100..c016c13 100644 (file)
@@ -875,7 +875,7 @@ lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
  * Create new bitmap atlas and insert into hash table.
  */
 static struct gl_bitmap_atlas *
-alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
+alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase, bool isGenName)
 {
    struct gl_bitmap_atlas *atlas;
 
@@ -884,7 +884,7 @@ alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase)
 
    atlas = calloc(1, sizeof(*atlas));
    if (atlas) {
-      _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas);
+      _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas, isGenName);
    }
 
    return atlas;
@@ -13651,7 +13651,7 @@ _mesa_GenLists(GLsizei range)
       GLint i;
       for (i = 0; i < range; i++) {
          _mesa_HashInsertLocked(ctx->Shared->DisplayList, base + i,
-                                make_list(base + i, 1));
+                                make_list(base + i, 1), true);
       }
    }
 
@@ -13664,7 +13664,7 @@ _mesa_GenLists(GLsizei range)
        */
       struct gl_bitmap_atlas *atlas = lookup_bitmap_atlas(ctx, base);
       if (!atlas) {
-         atlas = alloc_bitmap_atlas(ctx, base);
+         atlas = alloc_bitmap_atlas(ctx, base, true);
       }
       if (atlas) {
          /* Atlas _should_ be new/empty now, but clobbering is OK */
@@ -13770,7 +13770,7 @@ _mesa_EndList(void)
    /* Install the new list */
    _mesa_HashInsert(ctx->Shared->DisplayList,
                     ctx->ListState.CurrentList->Name,
-                    ctx->ListState.CurrentList);
+                    ctx->ListState.CurrentList, true);
 
 
    if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
@@ -13857,7 +13857,7 @@ render_bitmap_atlas(struct gl_context *ctx, GLsizei n, GLenum type,
       /* Even if glGenLists wasn't called, we can still try to create
        * the atlas now.
        */
-      atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase);
+      atlas = alloc_bitmap_atlas(ctx, ctx->List.ListBase, false);
    }
 
    if (atlas && !atlas->complete && !atlas->incomplete) {
index 777a5dd..c00e23d 100644 (file)
@@ -182,7 +182,7 @@ _mesa_CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
          /* insert into hash table */
          _mesa_HashInsertLocked(ctx->Shared->MemoryObjects,
                                 memoryObjects[i],
-                                memObj);
+                                memObj, true);
       }
    }
 
@@ -607,7 +607,7 @@ _mesa_GenSemaphoresEXT(GLsizei n, GLuint *semaphores)
       for (GLsizei i = 0; i < n; i++) {
          semaphores[i] = first + i;
          _mesa_HashInsertLocked(ctx->Shared->SemaphoreObjects,
-                                semaphores[i], &DummySemaphoreObject);
+                                semaphores[i], &DummySemaphoreObject, true);
       }
    }
 
@@ -886,7 +886,7 @@ _mesa_ImportSemaphoreFdEXT(GLuint semaphore,
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
          return;
       }
-      _mesa_HashInsert(ctx->Shared->SemaphoreObjects, semaphore, semObj);
+      _mesa_HashInsert(ctx->Shared->SemaphoreObjects, semaphore, semObj, true);
    }
 
    ctx->Driver.ImportSemaphoreFd(ctx, semObj, fd);
index 20d88e2..f4a0e8a 100644 (file)
@@ -174,7 +174,7 @@ _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
    /* Name exists but buffer is not initialized */
    if (fb == &DummyFramebuffer) {
       fb = ctx->Driver.NewFramebuffer(ctx, id);
-      _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb);
+      _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb, true);
    }
    /* Name doesn't exist */
    else if (!fb) {
@@ -183,7 +183,7 @@ _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
          return NULL;
       }
-      _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb);
+      _mesa_HashInsert(ctx->Shared->FrameBuffers, id, fb, false);
    }
    return fb;
 }
@@ -1517,6 +1517,7 @@ _mesa_IsRenderbuffer(GLuint renderbuffer)
 
 static struct gl_renderbuffer *
 allocate_renderbuffer_locked(struct gl_context *ctx, GLuint renderbuffer,
+                             bool isGenName,
                              const char *func)
 {
    struct gl_renderbuffer *newRb;
@@ -1528,7 +1529,8 @@ allocate_renderbuffer_locked(struct gl_context *ctx, GLuint renderbuffer,
       return NULL;
    }
    assert(newRb->AllocStorage);
-   _mesa_HashInsertLocked(ctx->Shared->RenderBuffers, renderbuffer, newRb);
+   _mesa_HashInsertLocked(ctx->Shared->RenderBuffers, renderbuffer,
+                          newRb, isGenName);
 
    return newRb;
 }
@@ -1550,10 +1552,12 @@ bind_renderbuffer(GLenum target, GLuint renderbuffer)
     */
 
    if (renderbuffer) {
+      bool isGenName = false;
       newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
       if (newRb == &DummyRenderbuffer) {
          /* ID was reserved, but no real renderbuffer object made yet */
          newRb = NULL;
+         isGenName = true;
       }
       else if (!newRb && ctx->API == API_OPENGL_CORE) {
          /* All RB IDs must be Gen'd */
@@ -1565,7 +1569,7 @@ bind_renderbuffer(GLenum target, GLuint renderbuffer)
       if (!newRb) {
          _mesa_HashLockMutex(ctx->Shared->RenderBuffers);
          newRb = allocate_renderbuffer_locked(ctx, renderbuffer,
-                                              "glBindRenderbufferEXT");
+                                              isGenName, "glBindRenderbufferEXT");
          _mesa_HashUnlockMutex(ctx->Shared->RenderBuffers);
       }
    }
@@ -2037,11 +2041,11 @@ create_render_buffers(struct gl_context *ctx, GLsizei n, GLuint *renderbuffers,
       renderbuffers[i] = name;
 
       if (dsa) {
-         allocate_renderbuffer_locked(ctx, name, func);
+         allocate_renderbuffer_locked(ctx, name, true, func);
       } else {
          /* insert a dummy renderbuffer into the hash table */
          _mesa_HashInsertLocked(ctx->Shared->RenderBuffers, name,
-                                &DummyRenderbuffer);
+                                &DummyRenderbuffer, true);
       }
    }
 
@@ -2790,7 +2794,8 @@ _mesa_NamedRenderbufferStorageEXT(GLuint renderbuffer, GLenum internalformat,
    struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
    if (!rb || rb == &DummyRenderbuffer) {
       _mesa_HashLockMutex(ctx->Shared->RenderBuffers);
-      rb = allocate_renderbuffer_locked(ctx, renderbuffer, "glNamedRenderbufferStorageEXT");
+      rb = allocate_renderbuffer_locked(ctx, renderbuffer, rb != NULL,
+                                        "glNamedRenderbufferStorageEXT");
       _mesa_HashUnlockMutex(ctx->Shared->RenderBuffers);
    }
    renderbuffer_storage(ctx, rb, internalformat, width, height, NO_SAMPLES,
@@ -2818,7 +2823,7 @@ _mesa_NamedRenderbufferStorageMultisampleEXT(GLuint renderbuffer, GLsizei sample
    struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
    if (!rb || rb == &DummyRenderbuffer) {
       _mesa_HashLockMutex(ctx->Shared->RenderBuffers);
-      rb = allocate_renderbuffer_locked(ctx, renderbuffer,
+      rb = allocate_renderbuffer_locked(ctx, renderbuffer, rb != NULL,
                                         "glNamedRenderbufferStorageMultisampleEXT");
       _mesa_HashUnlockMutex(ctx->Shared->RenderBuffers);
    }
@@ -2936,7 +2941,8 @@ _mesa_GetNamedRenderbufferParameterivEXT(GLuint renderbuffer, GLenum pname,
    struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
    if (!rb || rb == &DummyRenderbuffer) {
       _mesa_HashLockMutex(ctx->Shared->RenderBuffers);
-      rb = allocate_renderbuffer_locked(ctx, renderbuffer, "glGetNamedRenderbufferParameterivEXT");
+      rb = allocate_renderbuffer_locked(ctx, renderbuffer, rb != NULL,
+                                        "glGetNamedRenderbufferParameterivEXT");
       _mesa_HashUnlockMutex(ctx->Shared->RenderBuffers);
    }
 
@@ -3034,11 +3040,13 @@ bind_framebuffer(GLenum target, GLuint framebuffer)
    }
 
    if (framebuffer) {
+      bool isGenName = false;
       /* Binding a user-created framebuffer object */
       newDrawFb = _mesa_lookup_framebuffer(ctx, framebuffer);
       if (newDrawFb == &DummyFramebuffer) {
          /* ID was reserved, but no real framebuffer object made yet */
          newDrawFb = NULL;
+         isGenName = true;
       }
       else if (!newDrawFb && ctx->API == API_OPENGL_CORE) {
          /* All FBO IDs must be Gen'd */
@@ -3054,7 +3062,7 @@ bind_framebuffer(GLenum target, GLuint framebuffer)
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFramebufferEXT");
             return;
          }
-         _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newDrawFb);
+         _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newDrawFb, isGenName);
       }
       newReadFb = newDrawFb;
    }
@@ -3236,7 +3244,7 @@ create_framebuffers(GLsizei n, GLuint *framebuffers, bool dsa)
       else
          fb = &DummyFramebuffer;
 
-      _mesa_HashInsertLocked(ctx->Shared->FrameBuffers, name, fb);
+      _mesa_HashInsertLocked(ctx->Shared->FrameBuffers, name, fb, true);
    }
 
    _mesa_HashUnlockMutex(ctx->Shared->FrameBuffers);
@@ -4839,7 +4847,7 @@ lookup_named_framebuffer_ext_dsa(struct gl_context *ctx, GLuint framebuffer, con
       /* Then, make sure it's initialized */
       if (fb == &DummyFramebuffer) {
          fb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
-         _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, fb);
+         _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, fb, true);
       }
    }
    else
index 664e464..1771882 100644 (file)
@@ -159,7 +159,7 @@ _mesa_glthread_GenVertexArrays(struct gl_context *ctx,
 
       vao->Name = id;
       _mesa_glthread_reset_vao(vao);
-      _mesa_HashInsertLocked(glthread->VAOs, id, vao);
+      _mesa_HashInsertLocked(glthread->VAOs, id, vao, true);
    }
 }
 
index 99249c4..5f053c3 100644 (file)
@@ -198,9 +198,11 @@ _mesa_HashInsert_unlocked(struct _mesa_HashTable *table, GLuint key, void *data)
  * \param table the hash table.
  * \param key the key (not zero).
  * \param data pointer to user data.
+ * \param isGenName true if the key has been generated by a HashFindFreeKey* function
  */
 void
-_mesa_HashInsertLocked(struct _mesa_HashTable *table, GLuint key, void *data)
+_mesa_HashInsertLocked(struct _mesa_HashTable *table, GLuint key, void *data,
+                       GLboolean isGenName)
 {
    _mesa_HashInsert_unlocked(table, key, data);
 }
@@ -213,9 +215,11 @@ _mesa_HashInsertLocked(struct _mesa_HashTable *table, GLuint key, void *data)
  * \param table the hash table.
  * \param key the key (not zero).
  * \param data pointer to user data.
+ * \param isGenName true if the key has been generated by a HashFindFreeKey* function
  */
 void
-_mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
+_mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data,
+                 GLboolean isGenName)
 {
    _mesa_HashLockMutex(table);
    _mesa_HashInsert_unlocked(table, key, data);
index 0a3996a..3642491 100644 (file)
@@ -113,7 +113,8 @@ extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table);
 
 extern void *_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key);
 
-extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data);
+extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data,
+                             GLboolean isGenName);
 
 extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key);
 
@@ -149,7 +150,7 @@ _mesa_HashUnlockMutex(struct _mesa_HashTable *table)
 extern void *_mesa_HashLookupLocked(struct _mesa_HashTable *table, GLuint key);
 
 extern void _mesa_HashInsertLocked(struct _mesa_HashTable *table,
-                                   GLuint key, void *data);
+                                   GLuint key, void *data, GLboolean isGenName);
 
 extern void _mesa_HashRemoveLocked(struct _mesa_HashTable *table, GLuint key);
 
index 3273f15..d485aca 100644 (file)
@@ -368,7 +368,7 @@ _mesa_GenPerfMonitorsAMD(GLsizei n, GLuint *monitors)
             return;
          }
          monitors[i] = first + i;
-         _mesa_HashInsert(ctx->PerfMonitor.Monitors, first + i, m);
+         _mesa_HashInsert(ctx->PerfMonitor.Monitors, first + i, m, true);
       }
    } else {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenPerfMonitorsAMD");
index c5825a7..ce1dd96 100644 (file)
@@ -462,7 +462,7 @@ _mesa_CreatePerfQueryINTEL(GLuint queryId, GLuint *queryHandle)
    obj->Active = false;
    obj->Ready = false;
 
-   _mesa_HashInsert(ctx->PerfQuery.Objects, id, obj);
+   _mesa_HashInsert(ctx->PerfQuery.Objects, id, obj, true);
    *queryHandle = id;
 }
 
index f12bcfe..5bbd886 100644 (file)
@@ -153,7 +153,7 @@ static void
 save_pipeline_object(struct gl_context *ctx, struct gl_pipeline_object *obj)
 {
    if (obj->Name > 0) {
-      _mesa_HashInsertLocked(ctx->Pipeline.Objects, obj->Name, obj);
+      _mesa_HashInsertLocked(ctx->Pipeline.Objects, obj->Name, obj, true);
    }
 }
 
index e54a37b..8c66808 100644 (file)
@@ -287,7 +287,7 @@ create_queries(struct gl_context *ctx, GLenum target, GLsizei n, GLuint *ids,
             q->EverBound = GL_TRUE;
          }
          ids[i] = first + i;
-         _mesa_HashInsertLocked(ctx->Query.QueryObjects, first + i, q);
+         _mesa_HashInsertLocked(ctx->Query.QueryObjects, first + i, q, true);
       }
    }
 }
@@ -457,7 +457,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}");
             return;
          }
-         _mesa_HashInsertLocked(ctx->Query.QueryObjects, id, q);
+         _mesa_HashInsertLocked(ctx->Query.QueryObjects, id, q, false);
       }
    }
    else {
@@ -599,7 +599,7 @@ _mesa_QueryCounter(GLuint id, GLenum target)
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glQueryCounter");
          return;
       }
-      _mesa_HashInsertLocked(ctx->Query.QueryObjects, id, q);
+      _mesa_HashInsertLocked(ctx->Query.QueryObjects, id, q, false);
    }
    else {
       if (q->Target && q->Target != GL_TIMESTAMP) {
index 271983e..9fd857b 100644 (file)
@@ -179,7 +179,7 @@ create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers,
          return;
       }
 
-      _mesa_HashInsertLocked(ctx->Shared->SamplerObjects, name, sampObj);
+      _mesa_HashInsertLocked(ctx->Shared->SamplerObjects, name, sampObj, true);
       samplers[i] = name;
    }
 
index 86c8c85..7039b61 100644 (file)
@@ -341,7 +341,7 @@ create_shader(struct gl_context *ctx, GLenum type)
    name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
    sh = _mesa_new_shader(name, _mesa_shader_enum_to_shader_stage(type));
    sh->Type = type;
-   _mesa_HashInsertLocked(ctx->Shared->ShaderObjects, name, sh);
+   _mesa_HashInsertLocked(ctx->Shared->ShaderObjects, name, sh, true);
    _mesa_HashUnlockMutex(ctx->Shared->ShaderObjects);
 
    return name;
@@ -373,7 +373,7 @@ create_shader_program(struct gl_context *ctx)
 
    shProg = _mesa_new_shader_program(name);
 
-   _mesa_HashInsertLocked(ctx->Shared->ShaderObjects, name, shProg);
+   _mesa_HashInsertLocked(ctx->Shared->ShaderObjects, name, shProg, true);
 
    assert(shProg->RefCount == 1);
 
index 895b566..867536d 100644 (file)
@@ -2915,7 +2915,9 @@ lookup_texture_ext_dsa(struct gl_context *ctx, GLenum target, GLuint texture,
       texObj = ctx->Shared->DefaultTex[targetIndex];
       assert(texObj);
    } else {
+      bool isGenName;
       texObj = _mesa_lookup_texture(ctx, texture);
+      isGenName = texObj != NULL;
       if (!texObj && ctx->API == API_OPENGL_CORE) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", caller);
          return NULL;
@@ -2929,7 +2931,7 @@ lookup_texture_ext_dsa(struct gl_context *ctx, GLenum target, GLuint texture,
          }
 
          /* insert into hash table */
-         _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj);
+         _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj, isGenName);
       }
 
       if (texObj->Target != boundTarget) {
index 3e05897..a81838e 100644 (file)
@@ -1237,7 +1237,7 @@ create_textures(struct gl_context *ctx, GLenum target,
       }
 
       /* insert into hash table */
-      _mesa_HashInsertLocked(ctx->Shared->TexObjects, texObj->Name, texObj);
+      _mesa_HashInsertLocked(ctx->Shared->TexObjects, texObj->Name, texObj, true);
 
       textures[i] = name;
    }
@@ -1802,7 +1802,7 @@ _mesa_lookup_or_create_texture(struct gl_context *ctx, GLenum target,
          }
 
          /* and insert it into hash table */
-         _mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj);
+         _mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj, false);
       }
    }
 
index 5826447..b3b7f1e 100644 (file)
@@ -1083,7 +1083,7 @@ create_transform_feedbacks(struct gl_context *ctx, GLsizei n, GLuint *ids,
          }
          ids[i] = first + i;
          _mesa_HashInsertLocked(ctx->TransformFeedback.Objects, first + i,
-                                obj);
+                                obj, true);
          if (dsa) {
             /* this is normally done at bind time in the non-dsa case */
             obj->EverBound = GL_TRUE;