Advertisement Jump to content
Sign in to follow this  

Runtime BC7 texture compression

This topic is 1171 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

      Have taken a look at Microsoft's DirectX11 DirectCompute BC6/7 compressor here :

As a next step I want to maintain the compressed result in video memory and use it as a runtime texture. Trying BC7 first.

Bounce down to system memory & copy into BC7 staging texture works but that's inefficient.

So ... rather than create the Buffer11 result with a UAV over it as the sample does, I tried creating a BC7 texture.

This fails because you can't apparently create a UAV over a BC7 (sigh).

Review here :

... does not list BC7 in the "Typed UAV" section????
Furthermore creating as DXGI_FORMAT_R32G32_UINT and blitting into BC7 destination in a similar way to the technique used here :

fails as it seems CopyResource does not support BC7 as a destination from a UINT source.

~D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion when the Formats of each Resource are not the same or at least castable to each other, unless one format is compressed (DXGI_FORMAT_R9G9B9E5_SHAREDEXP, or DXGI_FORMAT_BC[1,2,3,4,5]_* ) and the source format is similar to the dest according to: BC[1|4] ~= R16G16B16A16|R32G32, BC[2|3|5] ~= R32G32B32A32, R9G9B9E5_SHAREDEXP ~= R32. [ RESOURCE_MANIPULATION ERROR #281: COPYSUBRESOURCEREGION_INVALIDSOURCE?

Note no mention of BC6 or 7 formats.

Have emailed Chuck at Microsoft. Maybe he has a solution. Input welcome from anyone else.

Right now, it seems like the solution is bypass DirectCompute & do the same thing in OpenCL instead as a way to work around the restrictions.

?An example here which I'll take a look at next :


Thanks in advance for any input.


Best regards,?

Edited by advance-software

Share this post

Link to post
Share on other sites

Volition OpenCL example takes around a second to compress a 512x512 texture on my GTX960.

So can't do that in primary thread. Therefore secondary thread leave result in system memory & upload in primary when ready is probably the optimal solution for now anyway :)?

All the same, would be nice for things to just work and for reasonable interface requests to be granted.

Aside - volition example requires the following OpenCL code change to compile on my system :

FROM: bc7_encoded_block encoded_block = { 0 };
TO : bc7_encoded_block encoded_block = { {0, 0, 0, 0} };


Share this post

Link to post
Share on other sites

Thanks Chuck.

Would be nice if the ?UAV over all formats, including compressed could be added to the next point release of Direct 11 & 12 unless there are IHV reasons for not doing so. The API shouldn't get in the way, but right now it is doing so. OpenCL seems the workaround for DX view restrictions for the time being.

Will try BC7 mode 6 block fast encode via OpenCL as a solution over current generation hardware. Thanks for that.

Going forwards, @IHV (who I appreciate won't in the main be reading - just thinking out loud), our ideal solution is real-time jpeg-2000 source -> BC7 or above encode for colour maps.?

R?eason: 3D web. jpg-2000 gets us optimal network transfer efficiency. BC7 gets us optimal GPU efficiency.

Suggest implement directly in hardware like video encode/decode. 

Problems like this highlight API and hardware limitations which is all good because that provides part of the feature set for tomorrow's technology.

???Thanks all for your input and for the reference implementations.

Note to self :


Edited by advance-software

Share this post

Link to post
Share on other sites

According to ASTC is available via D3D, but in Windows 10 only. Unfortunately, there's no citation to back that claim up.


It is available on OpenGL as an extension - "KHR_texture_compression_astc_ldr".


I can't find any information on which current PC GPUs support it, if any. I suspect that means none do support it, as that sort of thing tends to get mentioned in reviews. This article says it is supported on some mobile phone GPUs.


Because of the limited support, it probably won't be very useful for PC games for a few years. One of the big advantages of DXT1 and DXT5 is that all PC GPUs support them, so you don't have to handle the awkward case where the hardware can't use your compressed texture data.

Edited by Adam_42

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!