Sign in to follow this  
lomateron

Shader Resource View and Load()

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
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

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