Can't update a Dxt1 texture at runtime - assert(4 ==1) problem

I’ve hit on a bit of a problem while attempting to update a texture at runtime. This process is all working for 8bit greyscale images, but it can’t seem to work for DXT1

Basically I’m calling RHIUpdateTexture2D via the ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER macro. Uploading a DXT image fails however. The error is:

D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.2\Engine\Source\Runtime\Windows\D3D11RHI\Private\D3D11Texture.cpp(1432): Assertion failed: GPixelFormats[Texture->GetFormat()].BlockSizeX == 1

Which looking at the source has:

check(GPixelFormats[Texture->GetFormat()].BlockSizeX == 1);

in that line that doesn’t reference any inputs to the function. If I add into my code, anywhere this assert:

check(GPixelFormats[PF_DXT1].BlockSizeX == 1);

I get the same Assertion failed: GPixelFormats[Texture->GetFormat()].BlockSizeX == 1

Is it possible to actually update a PF_DXT1 image or am I missing somthing?

Clearly this isn’t a good thing to do, but if you add: GPixelFormats[PF_DXT1].BlockSizeY = GPixelFormats[PF_DXT1].BlockSizeX = 1;

Just before the call it will succeed and update the texture fine - looks great.
But DXT blocksize isn’t 1, it’s 4 - it’s bound to break something else somewhere. But assert(4 == 1) is always going to exit the program.

Unsure how to proceed really…

I think the check is just there to make sure we get wrong copies in corner cases e.g. subrectangle is not block size aligned or stride computations need to incorporate padding. Usually we don’t update block compressed textures. Seems it can be fixed without much effort (remove the check and add checks to test for alignment).

Awesome. I know it’s not usual to import compressed but in this case it makes sense.