Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 2.2 KB

0079-2023-05-12.md

File metadata and controls

36 lines (29 loc) · 2.2 KB

12 May 2023

Previous journal: Next journal:
0078-2023-05-10.md 0080-2023-05-16.md

Raybox

Accomplishments

  • Fixed larger column heights (scan scale up to 511 height now instead of 240).
  • Got texture mapping to work in a synthesisable way by shifting the height scaler reciprocal out of tracer and into raybox. The texture itself is not in the design yet, though: the memory is, but there's no way to write to it (except faking it via the sim).

Notes

  • Is there a way we could do some sort of hardware interpolation while rendering upscaled textures?
  • Now that we've changed to storing vdist instead of height, there is some slightly noticeable up/down wobble in the textures as we move, I guess because now the texture calculation varies on a sub-pixel level rather than just coming directly from a consistent column height. Is there a way to stabilise this? e.g. drop a bit or so of precision after the reciprocal?
  • We maybe don't need to store a full 16 bits per column trace distance. I only selected that to accommodate 7 bits for integer part going up to ~91, and fractional part doing down to 1/512. Precision really only needs to be ~9 bits, though (because height on screen ranges from 1..511). We then need an exponent, and together both the exponent and mantissa could already be calculated (for free?) by the reciprocal logic... or at least we can use the LZC.
    • Assume an unsigned mantissa of 9 bits, and an unsigned exponent of 3 bits (12 bits total):
      • E=0, M=xxxxxxxxx is our precision: 000'0000.xxxx'xxxx'x
      • E=0, M=000000001 is the smallest possible value: 000'0000.0000'0000'1 = 1/512
      • E=7, M=111111111 is the largest possible value: 111'1111.1100'0000'0 = 127.75
  • When using a reciprocal that doesn't have matched M and N, would it make sense to flip the M and N values for the output? Not quite:
    • Reciprocal of 000.0000001 (Q3.7) is 10000000.000 which clearly won't fit in Q3.7, and instead requires Q8.x.
    • However, compare this with 111.0000001 (897), whose reciprocal is 0.0000000001001001000011... (0.00111482720...)