Backends: amend comments to state that bilinear filtering is required ahead of 1.93.

This commit is contained in:
ocornut 2026-07-31 22:07:01 +02:00
parent f1cc2ae15e
commit 9b7699f325
12 changed files with 12 additions and 22 deletions

View File

@ -268,8 +268,7 @@ void ImGui_ImplAllegro5_UpdateTexture(ImTextureData* tex)
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr); IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32); IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
// Create texture // Create texture (bilinear sampling is required)
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
const int new_bitmap_flags = al_get_new_bitmap_flags(); const int new_bitmap_flags = al_get_new_bitmap_flags();
int new_bitmap_format = al_get_new_bitmap_format(); int new_bitmap_format = al_get_new_bitmap_format();
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP | ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP | ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR);

View File

@ -557,8 +557,7 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
bd->pd3dDevice->CreateDepthStencilState(&desc, &bd->pDepthStencilState); bd->pd3dDevice->CreateDepthStencilState(&desc, &bd->pDepthStencilState);
} }
// Create texture sampler // Create texture sampler (bilinear sampling is required)
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
{ {
D3D10_SAMPLER_DESC desc; D3D10_SAMPLER_DESC desc;
ZeroMemory(&desc, sizeof(desc)); ZeroMemory(&desc, sizeof(desc));

View File

@ -608,7 +608,7 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
param[1].DescriptorTable.pDescriptorRanges = &descRange; param[1].DescriptorTable.pDescriptorRanges = &descRange;
param[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL; param[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
// Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling. // Bilinear sampling is required
D3D12_STATIC_SAMPLER_DESC staticSampler[1] = {}; D3D12_STATIC_SAMPLER_DESC staticSampler[1] = {};
staticSampler[0].Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; staticSampler[0].Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
staticSampler[0].AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; staticSampler[0].AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;

View File

@ -584,7 +584,7 @@ void ImGui_ImplMetal_Shutdown()
return [[MetalBuffer alloc] initWithBuffer:backing]; return [[MetalBuffer alloc] initWithBuffer:backing];
} }
// Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling. // Bilinear sampling is required.
- (id<MTLRenderPipelineState>)renderPipelineStateForFramebufferDescriptor:(FramebufferDescriptor*)descriptor device:(id<MTLDevice>)device - (id<MTLRenderPipelineState>)renderPipelineStateForFramebufferDescriptor:(FramebufferDescriptor*)descriptor device:(id<MTLDevice>)device
{ {
NSError* error = nil; NSError* error = nil;

View File

@ -276,8 +276,7 @@ void ImGui_ImplOpenGL2_UpdateTexture(ImTextureData* tex)
const void* pixels = tex->GetPixels(); const void* pixels = tex->GetPixels();
GLuint gl_texture_id = 0; GLuint gl_texture_id = 0;
// Upload texture to graphics system // Upload texture to graphics system (bilinear sampling is required).
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
GLint last_texture; GLint last_texture;
GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture)); GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture));
GL_CALL(glGenTextures(1, &gl_texture_id)); GL_CALL(glGenTextures(1, &gl_texture_id));

View File

@ -689,8 +689,7 @@ void ImGui_ImplOpenGL3_UpdateTexture(ImTextureData* tex)
const void* pixels = tex->GetPixels(); const void* pixels = tex->GetPixels();
GLuint gl_texture_id = 0; GLuint gl_texture_id = 0;
// Upload texture to graphics system // Upload texture to graphics system (bilinear sampling is required).
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
GLint last_texture; GLint last_texture;
GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture)); GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture));
GL_CALL(glGenTextures(1, &gl_texture_id)); GL_CALL(glGenTextures(1, &gl_texture_id));

View File

@ -591,7 +591,7 @@ void ImGui_ImplSDLGPU3_CreateDeviceObjects()
if (bd->TexSamplerLinear == nullptr) if (bd->TexSamplerLinear == nullptr)
{ {
// Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling. // Bilinear sampling is required.
SDL_GPUSamplerCreateInfo sampler_info = {}; SDL_GPUSamplerCreateInfo sampler_info = {};
sampler_info.min_filter = SDL_GPU_FILTER_LINEAR; sampler_info.min_filter = SDL_GPU_FILTER_LINEAR;
sampler_info.mag_filter = SDL_GPU_FILTER_LINEAR; sampler_info.mag_filter = SDL_GPU_FILTER_LINEAR;

View File

@ -213,8 +213,7 @@ void ImGui_ImplSDLRenderer2_UpdateTexture(ImTextureData* tex)
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr); IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32); IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
// Create texture // Create texture (bilinear sampling is required)
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
SDL_Texture* sdl_texture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, tex->Width, tex->Height); SDL_Texture* sdl_texture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, tex->Width, tex->Height);
IM_ASSERT(sdl_texture != nullptr && "Backend failed to create texture!"); IM_ASSERT(sdl_texture != nullptr && "Backend failed to create texture!");
SDL_UpdateTexture(sdl_texture, nullptr, tex->GetPixels(), tex->GetPitch()); SDL_UpdateTexture(sdl_texture, nullptr, tex->GetPixels(), tex->GetPitch());

View File

@ -242,8 +242,7 @@ void ImGui_ImplSDLRenderer3_UpdateTexture(ImTextureData* tex)
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr); IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32); IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
// Create texture // Create texture (bilinear sampling is required)
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
SDL_Texture* sdl_texture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, tex->Width, tex->Height); SDL_Texture* sdl_texture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, tex->Width, tex->Height);
IM_ASSERT(sdl_texture != nullptr && "Backend failed to create texture!"); IM_ASSERT(sdl_texture != nullptr && "Backend failed to create texture!");
SDL_UpdateTexture(sdl_texture, nullptr, tex->GetPixels(), tex->GetPitch()); SDL_UpdateTexture(sdl_texture, nullptr, tex->GetPixels(), tex->GetPitch());

View File

@ -1153,8 +1153,7 @@ bool ImGui_ImplVulkan_CreateDeviceObjects()
check_vk_result(err); check_vk_result(err);
} }
// Create samplers // Create samplers (bilinear sampling is required)
// Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling.
if (!bd->SamplerLinear || !bd->SamplerNearest) if (!bd->SamplerLinear || !bd->SamplerNearest)
{ {
VkSamplerCreateInfo info = {}; VkSamplerCreateInfo info = {};

View File

@ -844,8 +844,7 @@ bool ImGui_ImplWGPU_CreateDeviceObjects()
ImGui_ImplWGPU_CreateUniformBuffer(); ImGui_ImplWGPU_CreateUniformBuffer();
// Create samplers (Linear/Nearest) // Create samplers (Linear/Nearest) (bilinear sampling is required)
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
WGPUSamplerDescriptor sampler_desc = {}; WGPUSamplerDescriptor sampler_desc = {};
sampler_desc.addressModeU = WGPUAddressMode_ClampToEdge; sampler_desc.addressModeU = WGPUAddressMode_ClampToEdge;
sampler_desc.addressModeV = WGPUAddressMode_ClampToEdge; sampler_desc.addressModeV = WGPUAddressMode_ClampToEdge;

View File

@ -234,9 +234,7 @@ void MyImGuiBackend_RenderDrawData(ImDrawData* draw_data)
// - Scissor enabled // - Scissor enabled
MyEngineSetupenderState(); MyEngineSetupenderState();
// TODO: Setup texture sampling state // TODO: Setup texture sampler to bilinear (NOT point/nearest filtering).
// - Sample with bilinear filtering (NOT point/nearest filtering).
// - Use 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines;' to allow point/nearest filtering.
// TODO: Setup viewport covering draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize // TODO: Setup viewport covering draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize