Skip to content

Commit c3629ad

Browse files
committed
Backends: Metal: fixed ImTextureID cast. (#1641)
Amend 92b9498
1 parent 6b8accb commit c3629ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backends/imgui_impl_metal.mm

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void ImGui_ImplMetal_RenderDrawData(ImDrawData* drawData, id<MTLCommandBuffer> c
291291

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

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

352352
return (bd->SharedMetalContext.fontTexture != nil);
353353
}

0 commit comments

Comments
 (0)