Sign in to follow this  
lomateron

performance method

Recommended Posts

mhagain    13430
If the texture data never changes just do it at load time and store it out somewhere. Best case is that you'll be passing over the texels anyway so you can combine the computation with the pass; worst case is that you may need to copy it off to a staging resource, map that, and calculate from there. I don't know of any easy way to get the [i]lowest [/i]alpha at runtime for dynamic textures; [i]average [/i]alpha is easy as pie (just sample from the smallest mip level) but lowest? Nope.

Share this post


Link to post
Share on other sites
lomateron    491
It is a dynamic texture, I'm still looking for the fastest way to do it, not the easiest, i dont care about complexity. I have tought about rendering to another texture that is half the number of pixels of the original texture and to each pixel of this new texture will be rendered the lowest alpha bettwen 2 pixels of the original, and do this again and again until there is small number of pixels were its faster to read all of them and compare them in one pass(i mean in one shader method pass).

Share this post


Link to post
Share on other sites
phil_t    8084
Downsampling to one pixel will work. That will be the fastest, assuming you only need the value on the GPU (e.g. for a shader to sample from).

Do you need this information on the CPU? If so, do you need to maintain interactive framerates? If not, just copy the texture data to CPU memory and run through it.

Share this post


Link to post
Share on other sites
lomateron    491
I dont need the info in the CPU.
Can you help me on how to do that down sampling?
Is the that downsampling what i just write in my second comment or is another way. Edited by lomateron

Share this post


Link to post
Share on other sites
InvalidPointer    1842
FWIW you may be able to speed that up a bit by downsampling by a factor of 4 or more each pass-- usually write bandwidth doesn't scale quite as well as read does (and you do a lot more writing with a 2x2 than with a 4x4 or greater, let alone need more passes/CPU time)

Share this post


Link to post
Share on other sites
lomateron    491
If the texture is 1D and instead of RGBA, it has R, will it be faster if I increase the factor from 4 to 7? just to ask, i really dont think it will be.

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