Skip to content

Commit

Permalink
Backends: Metal: fixed ImTextureID cast. (#1641)
Browse files Browse the repository at this point in the history
Amend 92b9498
  • Loading branch information
ocornut committed Oct 8, 2024
1 parent 6b8accb commit 9248d8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backends/imgui_impl_metal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void ImGui_ImplMetal_RenderDrawData(ImDrawData* drawData, id<MTLCommandBuffer> c

// Bind texture, Draw
if (ImTextureID tex_id = pcmd->GetTexID())
[commandEncoder setFragmentTexture:(__bridge id<MTLTexture>)(tex_id) atIndex:0];
[commandEncoder setFragmentTexture:(__bridge id<MTLTexture>)(intptr_t)(tex_id) atIndex:0];

[commandEncoder setVertexBufferOffset:(vertexBufferOffset + pcmd->VtxOffset * sizeof(ImDrawVert)) atIndex:0];
[commandEncoder drawIndexedPrimitives:MTLPrimitiveTypeTriangle
Expand Down Expand Up @@ -347,7 +347,7 @@ bool ImGui_ImplMetal_CreateFontsTexture(id<MTLDevice> device)
id <MTLTexture> texture = [device newTextureWithDescriptor:textureDescriptor];
[texture replaceRegion:MTLRegionMake2D(0, 0, (NSUInteger)width, (NSUInteger)height) mipmapLevel:0 withBytes:pixels bytesPerRow:(NSUInteger)width * 4];
bd->SharedMetalContext.fontTexture = texture;
io.Fonts->SetTexID((__bridge void*)bd->SharedMetalContext.fontTexture); // ImTextureID == void*
io.Fonts->SetTexID((ImTextureID)(__bridge void*)bd->SharedMetalContext.fontTexture); // ImTextureID == ImU64

return (bd->SharedMetalContext.fontTexture != nil);
}
Expand Down

0 comments on commit 9248d8c

Please sign in to comment.