Ignore:
Timestamp:
Aug 3, 2015, 7:07:03 PM (9 years ago)
Author:
guerin
Message:

raycast: remove branch in draw loops

2364988 -> 2170519 cycles/frame (-8.9%) w/ 4 cpus, 512x512

File:
1 edited

Legend:

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

    r684 r685  
    3636static void dispDrawColumnTex(int x, int y0, int y1, unsigned char *line)
    3737{
    38     int y;
    39 
    40     if (x < 0 || x >= FBUF_X_SIZE)
    41         return;
    42 
    43     for (y = y0; y < y1 && y < FBUF_Y_SIZE; y++) {
    44         if (y < 0)
    45             y = 0;
    46 
     38    int y = (y0 >= 0 ? y0 : 0);
     39
     40    for (; y < y1 && y < FBUF_Y_SIZE; y++) {
     41        // Find texture coordinate
    4742        int ty = (y - y0) * TEX_SIZE / (y1 - y0);
    4843
     
    5348static void dispDrawColumnSolid(int x, int y0, int y1, unsigned char color)
    5449{
    55     int y;
    56 
    57     if (x < 0 || x >= FBUF_X_SIZE)
    58         return;
    59 
    60     for (y = y0; y < y1 && y < FBUF_Y_SIZE; y++) {
    61         if (y < 0)
    62             y = 0;
    63 
     50    int y = (y0 >= 0 ? y0 : 0);
     51
     52    for (; y < y1 && y < FBUF_Y_SIZE; y++) {
    6453        buf[cur_buf][y * FBUF_X_SIZE + x] = color;
    6554    }
Note: See TracChangeset for help on using the changeset viewer.