don't click here

What is the benefit of twiddling dreamcast textures?

Discussion in 'Engineering & Reverse Engineering' started by Cooljerk, Aug 11, 2016.

  1. Cooljerk

    Cooljerk

    NotEqual Tech, Inc - VR & Game Dev Oldbie
    4,505
    201
    43
    When doing Dreamcast development, twiddling your textures before using them really speeds up rendering performance. I know the algorithm to twiddle (and unwtiddle) textures, and I can see the performance increase myself, and many DC Dev resources recommend it, but I'm still lost as to precisely why there is a performance increase in the first place. What about twiddled textures makes them faster to render? Anybody care to weigh in?
     
  2. 360

    360

    Light Vision Overdrive Oldbie
    2,282
    1
    0
    United Kingdom
    Sonic Neon
    You have to preset the rasteriser driver to zero then jettison the flux capacitor in to overdrive and then overclock the modular blast processing core. :specialed:
     
  3. Cooljerk

    Cooljerk

    NotEqual Tech, Inc - VR & Game Dev Oldbie
    4,505
    201
    43
    Asked around on a different forum and got my answer (I honestly thought this place would get me an answer quickest, Sonic Retro be slipping).

    The reason for the performance increase is because the Holly chipset for the dreamcast has 4-port 16-bit VRAM, each with it's own address and data bus. So a single clock can read 4x16-bit texels. Only requirement is the 4 texture texels need to be in different banks/ports. Twiddling ensures adjacent texels will always be in different vram banks. So you get a form of parallelization when rendering.

    Thanks to MetalliC for the explanation, if he winds up posting here.
     
  4. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    Does anyone even do Dreamcast here? I mean, I know about PVR textures, but only because of SADXPC, where the twiddling probably doesn't matter (or makes it slower).
     
  5. Cooljerk

    Cooljerk

    NotEqual Tech, Inc - VR & Game Dev Oldbie
    4,505
    201
    43
    I'm working on a dreamcast game right now, actually.
     
  6. 360

    360

    Light Vision Overdrive Oldbie
    2,282
    1
    0
    United Kingdom
    Sonic Neon
    I responded faster than that forum! Did you remember to overclock the modular blast processing core? :specialed:

    Okay so being serious for a moment this sounds awesome! Do you have enough completed to create a thread? I'm definitely interested! I'd like to learn more - could you tell us more about it? I love the homebrew Dreamcast scene. Great to see it alive and kicking and on this very forum. Post more about your game! :)
     
  7. Cooljerk

    Cooljerk

    NotEqual Tech, Inc - VR & Game Dev Oldbie
    4,505
    201
    43
    Well, the dreamcast version is just a small port of a larger project that is cross platform and runs on PC and mobile as well. I'm maintaining 2 versions of my project - one using SDL 2.0 for modern platforms, and a Dreamcast PVR port. I'm not quite ready to show my project off to Retro, but when I started on the dreamcast port I took notes as I worked and am in the process of turning it into a DC Dev tutorial that walks you through the process of creating a small breakout clone, from creating the toolchain all the way to actually running the game on your Dreamcast. I did that as I worked to familiarize myself with KOS and PVR. I'll probably post that guide within the next month.
     
  8. winterhell

    winterhell

    Member
    1,165
    7
    18
    Just so we are clear, does that mean that the Dreamcast has its VRam in 4 blocks that are connected in Raid 0 and basically you have to make sure adjacent pixels end up in a different block?
     
  9. Cooljerk

    Cooljerk

    NotEqual Tech, Inc - VR & Game Dev Oldbie
    4,505
    201
    43
    No, the VRAM is [strike]one[/strike] two contiguous blocks of 32x1Mb that can be read as 8 MB total, but the output buffer of the dreamcast is split into 4 tiles that are rendered. Twiddling arranges the texels so that, when the data is read linearly, the texels are ready to go to the appropriate location according the block. I.E. texel 1 goes to block 1, texel 2 goes to block 2, texel 3 goes to block 3, texel 4 goes to block 4, texel 5 goes to block 1, texel 6 goes to block 2, texel 7 goes to block 3, etc. infinitely until you reach the end of the buffer. You don't need to spend time arranging the texels in VRAM, because the twiddle shape (butted up 'N' patterns) is per-arranging them for you. Memory access on the Dreamcast is slow, to the point where directly editing VRAM is inadvisable.

    This all assumes your texture is a power of 2 to begin with, which is a necessity to twiddle in the first place.
     
  10. 360

    360

    Light Vision Overdrive Oldbie
    2,282
    1
    0
    United Kingdom
    Sonic Neon
    Sounds promising! I'd love to see more one day. Please do post about it when you have enough completed to show it off. I'm definitely interested!