Advertisement

Reading/writing 16 bit unsigned integers from/to buffer

Started by September 08, 2017 08:43 PM
2 comments, last by _void_ 7 years, 5 months ago

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!

That's all correct, yes.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

Advertisement

@ajmilesGreat! Thanks

This topic is closed to new replies.

Advertisement