#define COOK_ON_DEMAND 1 #include "v4k.h" #define TEMP_GPU #ifdef TEMP_GPU #define TEX_WIDTH 256 // #define TEX_WIDTH 64 #else #define TEX_WIDTH 64 void temp_calc(vec4 *pixels){ // flood it for (int y = 1; y < TEX_WIDTH-1; y++){ for (int x = 1; x < TEX_WIDTH-1; x++){ int idx = (y * TEX_WIDTH) + x; vec4 *m = &pixels[idx]; vec4 sum = vec4(0,0,0,0); for (int cy = -1; cy <= 1; ++cy) { for (int cx = -1; cx <= 1; ++cx) { sum = add4(sum, pixels[((y+cy)*TEX_WIDTH)+(x+cx)]); } } *m = scale4(sum,1/9.0f); } } } #endif int main() { // 75% sized, MSAAx2 window_create(50, WINDOW_SQUARE); window_title(__FILE__); // window_fps_lock(1); texture_t tex; vec4 *img = REALLOC(0, TEX_WIDTH*TEX_WIDTH*sizeof(vec4)); for (int i=0; i