Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ inline Bool legalRadarPoint( Int px, Int py )

//-------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
static WW3DFormat findFormat(const WW3DFormat formats[])
static WW3DFormat findFormat(const WW3DFormat formats[], WW3DFormat fallback = WW3D_FORMAT_X8R8G8B8)
{
for( Int i = 0; formats[ i ] != WW3D_FORMAT_UNKNOWN; i++ )
{
Expand All @@ -89,16 +89,16 @@ static WW3DFormat findFormat(const WW3DFormat formats[])
}

}
// GeneralsX @bugfix BenderAI 24/02/2026 W3DRadar: When DXVK/MoltenVK caps query returns no supported
// format (e.g. CheckDeviceFormat fails on macOS for R8G8B8/R5G6B5), fall back to X8R8G8B8 which
// is guaranteed to be supported on any modern Vulkan-capable GPU. Without this, texture creation
// silently produces a null D3D texture and crashes later in buildTerrainTexture.
// GeneralsX @bugfix W3DRadar: When DXVK/MoltenVK caps query returns no supported
// format (e.g. CheckDeviceFormat fails on macOS for R8G8B8/R5G6B5), fall back to
// the provided fallback which is guaranteed to be supported on any modern Vulkan-capable GPU.
// Without this, texture creation silently produces a null D3D texture and crashes later in buildTerrainTexture.
#if !defined(_WIN32)
fprintf(stderr, "W3DRadar: findFormat: no supported format found in caps query - falling back to WW3D_FORMAT_X8R8G8B8\n");
fprintf(stderr, "W3DRadar: findFormat: no supported format found in caps query - falling back to %d\n", fallback);
fflush(stderr);
#endif
DEBUG_CRASH(("WW3DRadar: No appropriate texture format") );
return WW3D_FORMAT_X8R8G8B8;
return fallback;
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -130,13 +130,13 @@ void W3DRadar::initializeTextureFormats()
};

// find a format for the terrain texture
m_terrainTextureFormat = findFormat(terrainFormats);
m_terrainTextureFormat = findFormat(terrainFormats, WW3D_FORMAT_X8R8G8B8);

// find a format for the overlay texture
m_overlayTextureFormat = findFormat(overlayFormats);
m_overlayTextureFormat = findFormat(overlayFormats, WW3D_FORMAT_A8R8G8B8);

// find a format for the shroud texture
m_shroudTextureFormat = findFormat(shroudFormats);
m_shroudTextureFormat = findFormat(shroudFormats, WW3D_FORMAT_A8R8G8B8);

}

Expand Down
Loading