diff options
Diffstat (limited to 'src/gl.zig')
| -rw-r--r-- | src/gl.zig | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -359,7 +359,7 @@ pub const UniformCache = struct { pub fn deinit(self: *UniformCache) void { var it = self.uniforms.iterator(); while (it.next()) |entry| { - self.allocator.free(entry.key); + self.allocator.free(entry.key_ptr.*); } self.uniforms.deinit(); @@ -381,8 +381,8 @@ pub const UniformCache = struct { var it = self.uniforms.iterator(); var i: usize = 0; while (it.next()) |entry| { - existing_names[i] = entry.key; - existing_names_c[i] = entry.key.ptr; + existing_names[i] = entry.key_ptr.*; + existing_names_c[i] = entry.key_ptr.*.ptr; i += 1; } } @@ -397,8 +397,8 @@ pub const UniformCache = struct { for (existing_indices) |index, i| { const name = existing_names[i]; if (index == c.GL_INVALID_INDEX) { - if (self.uniforms.remove(name)) |removed| { - self.allocator.free(removed.key); + if (self.uniforms.remove(name)) { + self.allocator.free(name); } } else { var uniform = self.uniforms.get(name).?; @@ -415,14 +415,14 @@ pub const UniformCache = struct { var result = try self.uniforms.getOrPut(cloned_name); if (!result.found_existing) { - result.entry.value = CachedUniform.init(self.shader.*, name.ptr) catch { + result.value_ptr.* = CachedUniform.init(self.shader.*, name.ptr) catch { _ = self.uniforms.remove(cloned_name); self.allocator.free(cloned_name); return null; }; } - return &result.entry.value; + return result.value_ptr; } }; |
