mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 04:28:47 +02:00
Backends: Using SetTexID() consistently instead of assigning to ->TexID. May make the later obsolete eventually.
This commit is contained in:
@ -206,7 +206,7 @@ bool ImGui_ImplAllegro5_CreateDeviceObjects()
|
||||
return false;
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void*)cloned_img;
|
||||
io.Fonts->SetTexID((void*)cloned_img);
|
||||
g_Texture = cloned_img;
|
||||
|
||||
// Create an invisible mouse cursor
|
||||
@ -222,8 +222,9 @@ void ImGui_ImplAllegro5_InvalidateDeviceObjects()
|
||||
{
|
||||
if (g_Texture)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->SetTexID(NULL);
|
||||
al_destroy_bitmap(g_Texture);
|
||||
ImGui::GetIO().Fonts->TexID = NULL;
|
||||
g_Texture = NULL;
|
||||
}
|
||||
if (g_MouseCursorInvisible)
|
||||
|
@ -305,7 +305,7 @@ static void ImGui_ImplDX10_CreateFontsTexture()
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
|
||||
io.Fonts->SetTexID((ImTextureID)g_pFontTextureView);
|
||||
|
||||
// Create texture sampler
|
||||
{
|
||||
@ -482,7 +482,7 @@ void ImGui_ImplDX10_InvalidateDeviceObjects()
|
||||
return;
|
||||
|
||||
if (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->SetTexID(NULL); } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
|
||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||
|
||||
|
@ -317,7 +317,7 @@ static void ImGui_ImplDX11_CreateFontsTexture()
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
|
||||
io.Fonts->SetTexID((ImTextureID)g_pFontTextureView);
|
||||
|
||||
// Create texture sampler
|
||||
{
|
||||
@ -494,7 +494,7 @@ void ImGui_ImplDX11_InvalidateDeviceObjects()
|
||||
return;
|
||||
|
||||
if (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->SetTexID(NULL); } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
|
||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||
|
||||
|
@ -395,7 +395,7 @@ static void ImGui_ImplDX12_CreateFontsTexture()
|
||||
|
||||
// Store our identifier
|
||||
static_assert(sizeof(ImTextureID) >= sizeof(g_hFontSrvGpuDescHandle.ptr), "Can't pack descriptor handle into TexID, 32-bit not supported yet.");
|
||||
io.Fonts->TexID = (ImTextureID)g_hFontSrvGpuDescHandle.ptr;
|
||||
io.Fonts->SetTexID((ImTextureID)g_hFontSrvGpuDescHandle.ptr);
|
||||
}
|
||||
|
||||
bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||
@ -640,7 +640,7 @@ void ImGui_ImplDX12_InvalidateDeviceObjects()
|
||||
SafeRelease(g_pFontTextureResource);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->TexID = NULL; // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
io.Fonts->SetTexID(NULL); // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
|
||||
for (UINT i = 0; i < g_numFramesInFlight; i++)
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ static bool ImGui_ImplDX9_CreateFontsTexture()
|
||||
g_FontTexture->UnlockRect(0);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)g_FontTexture;
|
||||
io.Fonts->SetTexID((ImTextureID)g_FontTexture);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -273,7 +273,7 @@ void ImGui_ImplDX9_InvalidateDeviceObjects()
|
||||
return;
|
||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||
if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
|
||||
if (g_FontTexture) { g_FontTexture->Release(); g_FontTexture = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (g_FontTexture) { g_FontTexture->Release(); g_FontTexture = NULL; ImGui::GetIO().Fonts->SetTexID(NULL); } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
}
|
||||
|
||||
void ImGui_ImplDX9_NewFrame()
|
||||
|
@ -194,7 +194,7 @@ bool ImGui_Marmalade_CreateDeviceObjects()
|
||||
g_FontTexture->Upload();
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)g_FontTexture;
|
||||
io.Fonts->SetTexID((ImTextureID)g_FontTexture);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -209,8 +209,8 @@ void ImGui_Marmalade_InvalidateDeviceObjects()
|
||||
|
||||
if (g_FontTexture)
|
||||
{
|
||||
ImGui::GetIO().Fonts->SetTexID(0);
|
||||
delete g_FontTexture;
|
||||
ImGui::GetIO().Fonts->TexID = 0;
|
||||
g_FontTexture = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ bool ImGui_ImplMetal_CreateFontsTexture(id<MTLDevice> device)
|
||||
[g_sharedMetalContext makeFontTextureWithDevice:device];
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->TexID = (__bridge void *)g_sharedMetalContext.fontTexture; // ImTextureID == void*
|
||||
io.Fonts->SetTexID((__bridge void *)g_sharedMetalContext.fontTexture); // ImTextureID == void*
|
||||
|
||||
return (g_sharedMetalContext.fontTexture != nil);
|
||||
}
|
||||
@ -123,7 +123,7 @@ void ImGui_ImplMetal_DestroyFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
g_sharedMetalContext.fontTexture = nil;
|
||||
io.Fonts->TexID = nullptr;
|
||||
io.Fonts->SetTexID(nullptr);
|
||||
}
|
||||
|
||||
bool ImGui_ImplMetal_CreateDeviceObjects(id<MTLDevice> device)
|
||||
|
@ -227,7 +227,7 @@ bool ImGui_ImplOpenGL2_CreateFontsTexture()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
|
||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)g_FontTexture);
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
@ -241,7 +241,7 @@ void ImGui_ImplOpenGL2_DestroyFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
glDeleteTextures(1, &g_FontTexture);
|
||||
io.Fonts->TexID = 0;
|
||||
io.Fonts->SetTexID(0);
|
||||
g_FontTexture = 0;
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
|
||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)g_FontTexture);
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
@ -484,7 +484,7 @@ void ImGui_ImplOpenGL3_DestroyFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
glDeleteTextures(1, &g_FontTexture);
|
||||
io.Fonts->TexID = 0;
|
||||
io.Fonts->SetTexID(0);
|
||||
g_FontTexture = 0;
|
||||
}
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontImage;
|
||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)g_FontImage);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ static void ImGui_ImplWGPU_CreateFontsTexture()
|
||||
|
||||
// Store our identifier
|
||||
static_assert(sizeof(ImTextureID) >= sizeof(g_resources.FontTexture), "Can't pack descriptor handle into TexID, 32-bit not supported yet.");
|
||||
io.Fonts->TexID = (ImTextureID)g_resources.FontTextureView;
|
||||
io.Fonts->SetTexID((ImTextureID)g_resources.FontTextureView);
|
||||
}
|
||||
|
||||
static void ImGui_ImplWGPU_CreateUniformBuffer()
|
||||
@ -722,7 +722,7 @@ void ImGui_ImplWGPU_InvalidateDeviceObjects()
|
||||
SafeRelease(g_resources);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->TexID = NULL; // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
io.Fonts->SetTexID(NULL); // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
|
||||
for (unsigned int i = 0; i < g_numFramesInFlight; i++)
|
||||
SafeRelease(g_pFrameResources[i]);
|
||||
|
Reference in New Issue
Block a user