TapamN wrote:cloofoofoo wrote:Its polygon based. Its grid like near the player and simpler from a distance.
Are you talking about the demo from boob or SRR? I looked at the boob demo a very long time ago, so I don't remember much of it. But SRR does some weirdness when the camera goes below the water, and the waterfall stage has some weird glitches that make me think it might work like the Flipcode hardware accelerated version.
Nareez wrote:Hi everyone, I'm really happy that some people are interested in the Voxel Engine on the Dreamcast. I didn't expect anyone to care about that.
Unfortunately the demo still doesn't work on real hardware. Ian Michael showed me the error and I will work to correct it.
Many improvements need to be made, as I understand how to get the best out of the Dreamcast Hardware I will improve the Engine.
I'll show the progress on my twitter @NaReeZ
I noticed you're using sq_cpy to update the frame buffer in VRAM. This is much better than trying to use video RAM directly, but it's still pretty slow. There are faster ways to update a VRAM buffer.
I got the following timings for copying a frame buffer from main RAM to video RAM for a 640x480 16-bit frame buffer:
- memcpy: 20.80 ms
- KOS sq_cpy: 8.24 ms
- Modified sq_cpy: 3.89 ms
- DMA (includes optimized cache flush, waits for DMA to complete): 1.98 ms
- DMA (includes optimized cache flush, DMA works in background): 0.08 ms
For a 320x240 resolution screen, they would take about 1/4th the time. If you let the DMA work in the background, you wouldn't actually get all of the 1.90 ms saved when waiting, since the DMA will slow down CPU memory access. You might only save something like 1 ms total in an real game.
It looks like you tried to use DMA, but had trouble since KOS's DMA isn't designed to update the frame buffer. Video RAM DMA will only work if you enable the 3D driver... Also, KOS's cache flush function is partially broken; it does flush the cache, but it's much slower than it needs to be. Using KOS's dcache_flush_range would add an extra 1.84 ms to DMA timings I listed.
I don't have complete, sharable code for using DMA to the frame buffer without the PVR driver right now, but you can speed up sq_cpy by using this function instead of regular sq_cpy:
Code: Select all
void modified_sq_cpy_pvr32(void *dst, void *src, size_t len) {
//Set PVR DMA register
(volatile int *)0xA05F6888 = 1;
//Convert read/write area pointer to DMA write only area pointer
void *dmaareaptr = ((uintptr_t)dst & 0xffffff) | 0x11000000;
sq_cpy(dmaareaptr, src, len);
}
I have been trying to use your void modified_sq_cpy_pvr32 first up when you compile it there is this error dreamroq-player.c: In function 'modified_sq_cpy_pvr32':
dreamroq-player.c:72:31: error: lvalue required as left operand of assignment
dreamroq-player.c:75:23: warning: initialization makes pointer from integer without a cast [enabled by default]
So correct the compile error
Code: Select all
void modified_sq_cpy_pvr32(void *dst, void *src, size_t len) {
//Set PVR DMA register
*(volatile int *)0xA05F6888 = 1;
//Convert read/write area pointer to DMA write only area pointer
uint32_t dmaareaptr = ((uintptr_t)dst & 0xffffff) | 0x11000000;
sq_cpy((void *)dmaareaptr, src, len);
}
But when I use it on hardware now, I only get a black screen. I have talked to Flycast and Redream Development, and I need a working example so they can make it work in their emulators. As I think you told me, this does not work in them; it never did when I tested. I can't remember how I got this working when you posted it in the gens4all thread. But can you explain it more for them or give a working example using it simple, like for a CDI, I can send it to them so redream and flycast can then work this? And when I fixed the compile error, did I break the function?
Thanks, TapamN. I follow and study all your code, one of my heroes in coding, trying to step up my understanding of the DC hardware.