Sign in to follow this  

Better way to pass shaderresource views (in general:variable sized arrays) to effect.

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

D3D10: I have a more or less working way to set a variable amount of shaderresourceviews to the effect file. Nevertheless I am looking for the "right" way to do this. I set my array of ID3D10ShaderResourceView with the SetResourceArray. In the effect file I have a global Texture2D array/variable like "g_TexArray[100]". In addition I use a global variable that says how much views were set by the SetResourceArray function. In the shader I use a switch that maps a dynamic index (e.g. InstanceID) to the static index (from 0 to 99; the size of the g_TexArray array). The performance of the switch (which is huge) is very bad (on NV hardware) and additionally D3D10 Debug RT says to me that I do not set 100 views ;)... for sure I do not, but the additional variable that gives me the amount of valid entries in the array does the job well. All in all this is not a beautiful way to get variable arrays. However, I don't know how to do it in another way. Since copying to a texture2DArray is much much more work to do for the machine. Any suggestions? Thx, Vertex

Share this post


Link to post
Share on other sites
I don't fully understand what prevents you from using a texture array. You might need to copy to it, but if it's done once, that may be worth doing. Have you tried to do it to at least check the performance?

Share this post


Link to post
Share on other sites
Quote:
Original post by ET3D
I don't fully understand what prevents you from using a texture array. You might need to copy to it, but if it's done once, that may be worth doing. Have you tried to do it to at least check the performance?

I am still not as far as testing performance for both in a real world situation. The fact that prevents me from copying is that I only have 512 slices, which means I will need more than one anyway (and I can't really say how much). So it is "not really" a better situation. I will have up to some thousands of texts, most small, some big, but not really known before display and everyone is changing from never up to every frame. My aim is to reduce the CPU load, the frames are limited to 10FPS anyway. Normal use of Sprite/Font and render to texture both do use too much CPU. In addition I need Z coord and B2F order.

I get the resourceviews from ID3DX10Font, from which I can get access to the texture2D interfaces.

So, in addition I will need a texture2dArray for every font interface, since texture sizes may vary.

The copy operation should only happen if a new character is added to the strings, nevertheless creating a new texture2D (maybe a bit more can be allocated before), copying all slices to the new texture2d should hit kill my performance, shouldn't it? (I know I have to test). One thing is that I didn't knew a way to get access to the texture through the shaderresourceview

I already tried a lot, but NVs shaderperf tells me that performance is bad. I am still not able to write an appropriate shader.

Thx,
Vertex

Share this post


Link to post
Share on other sites

This topic is 3295 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.

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