Author Topic: Multiple uses for buffers. (not a question though)  (Read 2499 times)

0 Members and 1 Guest are viewing this topic.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
This isn't a question but thought it would fit in the general coding section.

I came up with an idea that may be useful..... or not, i dunno so anyway here it is:

At the moment I'm considering doing my software rendering in stages, the first stage only writing to the depth buffer and nothing else which is not uncommon or anything new but will enable me to use some optimisations that I have in mind.

Another part of the reason is I may use stencil shadows again and I thought it would be possible to use the colour buffer to do that with then when doing the texturing and shading I can read from the colour buffer to get the stencil value and use that in the shading calcs, my thinking being that using the colour buffer for both may be better on the cache (I don't really know though, anyone got any opinion on that?)

Then I thought that without the shadows something similar could be done using the depth buffer, only fill the colour buffer with the fp depth values in the first stage then when doing texturing/shading you can read the depth value from the colour buffer, if the depth test is equal then it is overwritten with the colour from texture/shading.

This has some drawbacks, after rendering you no longer have any depth information so alpha surfaces are out and probably lots of other things too but it got me thinking that maybe some other platforms with limited memory, maybe like some mobile devices, could make use of something like this idea.

And that's about it for my ramblings for the day.

Fryer.
« Last Edit: August 07, 2007 by Stonemonkey »

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Multiple uses for buffers. (not a question though)
« Reply #1 on: August 09, 2007 »
:)

There's no reason not to re-use the space, and it might pay off a bit on systems with a large cache.

I know I've used a zbuffer for collision code workspace before, since they're never in use at the same time.

Jim
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Multiple uses for buffers. (not a question though)
« Reply #2 on: August 10, 2007 »
Cheers Jim, I'm probably going to do that for the stencil buffer although it should be easy enough to make it able to work with an additional stencil buffer should i need that like in cases where i want to render a scene over an image already in the colour buffer.