Ignore:
Timestamp:
Aug 5, 2015, 6:46:13 PM (9 years ago)
Author:
guerin
Message:

raycast: precompute ymax

2087497 -> 2021308 cycles/frame (-3.2%) w/ 4 cpus, 512x512

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/raycast/disp.c

    r686 r691  
    3737{
    3838    int y = (y0 >= 0 ? y0 : 0);
    39 
    40     for (; y < y1 && y < FBUF_Y_SIZE; y++) {
     39    int ymax = (y1 < FBUF_Y_SIZE ? y1 : FBUF_Y_SIZE);
     40
     41    for (; y < ymax; y++) {
    4142        // Find texture coordinate
    4243        int ty = (y - y0) * TEX_SIZE / (y1 - y0);
     
    4950{
    5051    int y = (y0 >= 0 ? y0 : 0);
    51 
    52     for (; y < y1 && y < FBUF_Y_SIZE; y++) {
     52    int ymax = (y1 < FBUF_Y_SIZE ? y1 : FBUF_Y_SIZE);
     53
     54    for (; y < ymax; y++) {
    5355        buf[cur_buf][y * FBUF_X_SIZE + x] = color;
    5456    }
Note: See TracChangeset for help on using the changeset viewer.