Jump to content
  • Advertisement
Sign in to follow this  
_void_

DX12 How to deal with DXGI_FORMAT_B8G8R8A8_UNORM_SRGB

Recommended Posts

Hello guys,

I have a texture of format DXGI_FORMAT_B8G8R8A8_UNORM_SRGB.

Is there a way to create shader resource view for the texture so that I could read it as RGBA from the shader instead of reading it specifically as BGRA?

I would like all the textures to be read as RGBA.

 

Tx

Edited by _void_

Share this post


Link to post
Share on other sites
Advertisement
12 minutes ago, _void_ said:

I would like all the textures to be read as RGBA.

Why do you not use DXGI_FORMAT_R8G8B8A8_UNORM_SRGB instead of  DXGI_FORMAT_B8G8R8A8_UNORM_SRGB?

Share this post


Link to post
Share on other sites

Yeah, I can convert the texture to DXGI_FORMAT_R8G8B8A8_UNORM_SRGB format.

I thought maybe there is a way to work this around using shader resource view, which I do not know about :-) 

Share this post


Link to post
Share on other sites
15 minutes ago, _void_ said:

I thought maybe there is a way to work this around using shader resource view, which I do not know about :-) 

You can assign multiple shader resource views with different types to a resource, but I am not sure if you can interpret BGRA as RGBA since the underlying bytes of the resource are ordered differently.

Share this post


Link to post
Share on other sites

Am I being dumb, or wouldn't DXGI_FORMAT_B8G8R8A8 come through in the correct order into the shader without messing around with swizzles?

Share this post


Link to post
Share on other sites
22 minutes ago, ajmiles said:

Am I being dumb, or wouldn't DXGI_FORMAT_B8G8R8A8 come through in the correct order into the shader without messing around with swizzles?

Heh, that's a good point. It's essentially already got the swizzling baked into it so you can read it normally. Don't know why I didn't realize that...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!