Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(ww3d2): say when a mirrored texture loses its mip chain

Olcay Seygan6cfd1b2a38a0
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11texture.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11texture.cpp
index 4008d17cb..3c8eafef9 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11texture.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11texture.cpp
@@ -242,6 +242,18 @@ static ID3D11ShaderResourceView * build(ID3D11Device * device, ID3D11DeviceConte
const bool render_target = (description.Usage & D3DUSAGE_RENDERTARGET) != 0;
const bool empty = render_target || description.Pool == D3DPOOL_DEFAULT;
const unsigned level_count = empty ? 1 : two_dimensional->GetLevelCount();
+
+ // A texture made empty keeps one level, and DX11Texture_Update writes subresource zero, so a
+ // mip chain on one of these would be dropped and every distant surface wearing it would sample
+ // the top level and alias. Nothing in the measured maps has one - the empty ones are the bloom
+ // targets, the reflection and the scene copy, all single level - and this says so out loud
+ // rather than leaving it to be rediscovered from a picture.
+ if (empty && two_dimensional->GetLevelCount() > 1) {
+ char line[128];
+ sprintf(line, "%ux%u default pool with %u levels mirrored as one",
+ description.Width, description.Height, two_dimensional->GetLevelCount());
+ Notes.push_back(line);
+ }
const D3DFORMAT copy_format = is_sixteen_bit_colour(description.Format)
? D3DFMT_A8R8G8B8
: description.Format;