Shader Resource View and Load()

Started by
0 comments, last by Paul C Skertich 9 years, 7 months ago

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()
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.

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

This topic is closed to new replies.

Advertisement