XNA Creators Club Online
Page 1 of 1 (6 items)
Sort Posts: Previous Next

Fastest way to load (floating point) textures

Last post 03-25-2008 1:30 PM by The ZMan. 5 replies.
  • 03-25-2008 6:21 AM

    Fastest way to load (floating point) textures

    Hy,

    I was thinking about the fastest methode for uploading floating point textures to the GPU. Since I'm working on an out-of-core rendering engine (C#, DirectX), the time that the upload takes is crucial.

    1) First a more generell question. Assuming simple RGBA (32bit) textures: is it faster to use e.g. DDS textures and the texture loading mechanism or is it faster to simply dump the values in a binary file and manually overwrite the textures (in C# using Texture.LockRectangle + Marshal.Copy). Don't worry about the time needed for loading the texture from harddisk to the main memory. The uploading of the texture from the main memory to the GPU turned out to be the main bottleneck in my application. Are DDS texture decompressed on the GPU or on the CPU?

    2) Does anybody know an optimised way to upload 96bit floating point textures (I need 3 floating point channels -> 3*32bit) to the GPU? Ideally no information is lost. I read this article http://research.microsoft.com/research/pubs/view.aspx?tr_id=1198 - interesting but lossy.

    I hope I was able to point out my problem...
  • 03-25-2008 8:02 AM In reply to

    Re: Fastest way to load (floating point) textures

    SetData is the only way to set the contents of a texture using the XNA Framework.

    If you care about disk IO performance, using the Content Pipeline to read a precompiled .xnb file will be the fastest approach. But since you say you don't care about the IO side of things, all loading methods will be equal as they all ultimately end up calling SetData.

    The only way to get data into a texture without calling SetData is to draw it to a rendertarget. That might be interesting if you could somehow use a pixel shader to procedurally generate your image, but isn't generally applicable.

    DDS files are just a disk format, and don't mean anything to the GPU. I wonder if you're confusing the DDS file format with DXT texture compression? DXT compressed data is understood directly by the GPU, but DDS files can contain any format of texture data,, including DXT, RGBA, F32, etc. Regardless, DXT is very lossy and will not be appropriate if you need full floating point precision.

    XNA Framework Developer - blog - homepage
  • 03-25-2008 9:03 AM In reply to

    Re: Fastest way to load (floating point) textures

    I should have mentioned that I'm not working with the XNA Framework but simply C# + DirectX. I followed the notes in the MSDN forum in the Game Technologies section that lead me to this forum.
    quote:
    This forums is closed. Please post new questions on http://forums.xna.com. Thank you!

    Anyway :)

    true - I did mix up DDS with DXT texture compression. Thx for partly answering my first question :)
  • 03-25-2008 12:55 PM In reply to

    Re: Fastest way to load (floating point) textures

    > Does anybody know an optimised way to upload 96bit floating point textures

    You could probably use a 64bit fp texture + a 32bit fp texture.  I was going to do that in my GPGPU code, but I got lazy and used the 128bit format instead.  Using two textures leads to a bit of swizzeling in the shader, but if you are actually bandwidth constrained then it might be worth it.
  • 03-25-2008 1:08 PM In reply to

    Re: Fastest way to load (floating point) textures

    DonGrandioso:
    I should have mentioned that I'm not working with the XNA Framework but simply C# + DirectX. I followed the notes in the MSDN forum in the Game Technologies section that lead me to this forum. quote: This forums is closed. Please post new questions on http://forums.xna.com. Thank you!

    For future reference, even though it's not labled as such, the DirectX (C++) forums are actually the right place to ask non-XNA Framework questions. I'm not sure why it still says C++, but the convention adopted here is to put plain DirectX questions (C++ and/or MDX) there. It keeps down the confusion you've just experienced here.

     

  • 03-25-2008 1:30 PM In reply to

    Re: Fastest way to load (floating point) textures

    This was posted in the Algorithms forum - which are technology agnostic. The real problem is that 90% of the regualars are XNA framework people who view the forum in RSS or the 'unread' view so we don't always notice which forum it was posted in.

    But in this case it seems specific to an API so I will move it.



    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
Page 1 of 1 (6 items) Previous Next