Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Reading/writing 16 bit unsigned integers from/to buffer

$
0
0
Hi guys, I would like to double-check with you if I am correct. I have a buffer of unsigned integers of format DXGI_FORMAT_R16_UINT, which I would like to read from the shader. Since there is no dedicated HLSL 16 bit unsigned int type, I guess we should go with HLSL uint (32 bit) type. Buffer<uint> g_InputBuffer : register(t0); // DXGI_FORMAT_R16_UINT In this case, will each element of the input buffer be automatically converted into a corresponding uint (32 bit) element? And vice versa, if I want to output to buffer of type DXGI_FORMAT_R16_UINT, I guess HLSL uint will be automatically converted to 16 bit unsigned? RWBuffer<uint> g_OutputBuffer : register(u0); // DXGI_FORMAT_R16_UINT uint value = ... g_OutputBuffer[outIndex] = value; Thanks!

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>