» DDS Ring Buffer
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

DDS Ring Buffer

plugin cpu copy dds ring buffer video playback
Credits: elliotwoods

about

Currently hardcoded for DXT5

Introduction

I know a few of you are streaming DDS's off the HDD to playback video. Here's a ring buffer to do that.

Notes

  • All file loading is performed in off-mainloop threads
  • Pushing to GPU is performed on main thread (as required in DX9)
  • TextureUtils provides a mechanism to create textures from files (e.g. DDS), we use this mechanism for the first frame
  • Remaining frames with same resolution will be copied to GPU with an UpdateTexture function*
  • Keeps persistent memory buffers between frames if the file sizes are the same (i.e. true of DDS)

(*) I've manually coded the UpdateTexture function to parse the DDS file header and contents, and push the contents to the GPU without recreating the texture

DXT5 lookups are slow?

We didn't end up using this plugin, as we found that texture lookups became slower on DXT5 compared to X8R8G8B8 textures (hits the render stage).

I think in general this effect is negligible, but for the amount of texture lookups we're using (7 * HD in PS 3.0 on Radeon 6970's) it became a noticeable hit (dropped to 40fps min framerate vs 60-synced before). This effect continued after the texture was loaded (i.e. the slowdown was purely at render time).

The hypothesis that a texture lookup on DXT5 takes more GPU time than from an X8R8G8B8 makes theoretical sense, but might turn out to be incorrect. However, it is in line with our tests here.

download

EX9.TextureDDSBuffer.dll_.zip
22.08.12 [13:46 UTC] by catweasel | 577 downloads
DDS Ring Buffer v0.1

flux 22/08/2012 - 15:54

Nice, unfortunately it doesn't work on my machine. (Renderer stays black, node gets red when changing the value on the index pin)... any idea why?

elliotwoods 22/08/2012 - 15:59

@flux

thanks for the feedback
this is tested on b27. works across 3 machines here.
do you get anything in Renderer TTY?
which vvvv you on?

circuitb 22/08/2012 - 16:33

works here under beta28 with the
\vvvv_45beta28\lib\assets\images\meso_cubemap.dds = DXT format
but not with
\vvvv_45beta28\lib\assets\images\color_cubemap.dds which is a X8R8G8B8 texture

00:05:04 ERR : Exception occured in TMPluginWrapperNode.Evaluate: File format not supported by DDSFile

elliotwoods 22/08/2012 - 17:07

aha yes.
it's hardcoded for DXT5's right now! :)
will add that to the description

flux 22/08/2012 - 17:12

@elliot

sorry i forgot, i tested it on beta28. And i think it was the same issue circuitb mentioned. A8R8G8B8 dds textures don't seem to work. i got it running with dxt5 compressed ones on b27 and 28.

circuitb 24/08/2012 - 18:29

a spreadable version sounds possible?

elliotwoods 25/08/2012 - 15:58

yes.
certainly possible.
it's not going to be very tidy for changing spread-count
accidentally feeding in a large spread is going to either:
a) be capped (i.e. hard cap on number of slices)
b) crash (you'll allocate too much cpu and gpu ram)

is this something immediately useful?
i haven't got the source here anymore

circuitb 25/08/2012 - 18:15

no not really in a hurry just testing best ways to read image sequences
for something like 5 sequences of 200 frames ...
i duplicate the dds ring buffer node
everything is fine with a smooth playback!

but be careful with the buffercount value
vvvv dedicated memory get bigger and bigger each time you change this value (increase or decrease)... when it reaches the memory limit DDS nodes turns red and you need to restart vvvv to clear the allocated memory.

elliotwoods 26/08/2012 - 14:00

interesting.
i'm using byte arrays for storage which you can't actively flush (the .NET garbage collector is supposed to clean that up when it feels like).
I can provoke the garbage collector to get on with its job whenever you ask as well, so I can do that when the pin's changed
(flushing GC manually results in a temporary pause of the whole app, something like 50ms)

circuitb 26/08/2012 - 15:06

yep could be cool to manually flush the memory without restarting vvvv!

also the plugin doesn't work with the sharedtexture /dx9ex switch

anonymous user login

Shoutbox

~5d ago

joreg: In case you missed: We're starting with free bi-weekly introductions to #vvvv next week in #berlin free-vvvv-intro-workshops-this-summer-in-berlin #creativecoding

~5d ago

guest: uno|https://platform.uno/

~12d ago

joreg: @beyon too bad. but from now on we have a fixed schedule: every 4th tuesday in the month! hope this helps to plan evvvveryones visits

~12d ago

beyon: joreg: ah, bad timing, I would be happy to attend but I doesn't look like it will work out

~12d ago

joreg: @beyon any chance you can add 2 days to stay? would be great to have you at the (not yet announced) #vvvv meetup on the 23rd!

~13d ago

~13d ago

beyon: I'll be in Berlin July 13-22 - anything interesting going on in that time frame?