Jump to content
  • Advertisement
Sign in to follow this  
lomateron

Shader Resource View and Load()

This topic is 1479 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

Does someone here know how exactly I have to define 

D3D10_TEXTURE2D_DESC tex2D;

tex2D.MipLevels = ?;

 

D3D10_SHADER_RESOURCE_VIEW_DESC srvD;

srvD.Texture2D.MipLevels = ?;
srvD.Texture2D.MostDetailedMip = ?;
 
If I just want to work with individual texels all the time ...Load()

Share this post


Link to post
Share on other sites
Advertisement
D3D10_TEXTURE2D_DESC tex2D;
tex2D.MipLevels = 1;
tex2D.ArraySize = 1;
tex2D.Height = (height size of your texture.)
tex2D.Width = (width)
tex2D.Usage = D3D10_USAGE_DEFAULT;
tex2D.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
tex2D.CPUAccess = 0;
tex2D.Binding = D3D10_BIND_SHADER_RESOURCE;
tex2D.SampleDesc.Count = 1;
tex2D.SampleDesc.Quality = 0;
tex2D.MiscFlags = 0;

D3D10_SHADER_RESOURCE_VIEW_DESC srvD;
srvD.Texture2D.MipLevels = 1;
srvD.Texture2D.MostDetailedMip = 0;
srvD.ViewDimensions = D3D10_SRV_VIEW_DIMENSIONS_TEXTURE2D;
srvD.Format = tex2D.format;

I should've asked if you're trying to load a texture? If so then  you can use the D3DX10CreateShaderResourceViewFromFile

 

MSDN Reference of the function D3DX10CreateShaderResourceViewFromFile

http://msdn.microsoft.com/en-us/library/windows/desktop/bb172667%28v=vs.85%29.aspx

 

 

It would load the texture and create a shader resource view which you can place inside your shader code.

 

Unless you're trying to do something different.

Share this post


Link to post
Share on other sites
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!