Jump to content
  • Advertisement
Sign in to follow this  
_void_

DX11 Reading/writing 16 bit unsigned integers from/to buffer

This topic is 461 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,

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!

Edited by _void_

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!