#include #include #include #include #include #include #include void ac_log(const char *fmt,...) {(void)fmt;} typedef struct { int width,height,stride; uint32_t *pixels; } ACFramebuffer; #define HAVE_SCREEN_GPU #include "screen-gpu.h" static void solid_fixture(const char *path,int height) { FILE *f=fopen(path,"wb");assert(f); unsigned char p[]={255,0,0,128}; for(int i=0;i<1024*height;i++)assert(fwrite(p,1,4,f)==4); fclose(f); } static void fixture(const char *path,int height,int alpha) { FILE *f=fopen(path,"wb");assert(f); for(int y=0;y>16)&255)>=127 && ((pixel>>16)&255)<=129); assert((pixel&255)>=126 && (pixel&255)<=128); // Half-red blended over blue. assert(ac_gpu_begin(64,64,0,0,0)); assert(ac_gpu_theme_sprite(2,effect,0,1));ac_gpu_triangle(tri);ac_gpu_end(&fb); assert(pixels[8*64+8]==0xff0000ff); // VFX never occludes later geometry. effect[2]=effect[3]=1254; for(int depth_write=0;depth_write<=1;depth_write++) { assert(ac_gpu_begin(64,64,0,0,0)); assert(ac_gpu_theme_sprite(3,effect,0,depth_write)); ac_gpu_triangle(tri);ac_gpu_end(&fb); if(depth_write)assert((pixels[8*64+8]&0xffffff)==0x800000); else assert(pixels[8*64+8]==0xff0000ff); } // Faint atlas speckles must not occlude geometry when drawing solid props. unsigned char faint[]={255,0,0,8}; glBindTexture(GL_TEXTURE_2D,ac_gpu.theme_textures[3]); glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,1,1,0,GL_RGBA,GL_UNSIGNED_BYTE,faint); assert(ac_gpu_begin(64,64,0,0,0)); assert(ac_gpu_theme_sprite(3,effect,0,1)); ac_gpu_triangle(tri);ac_gpu_end(&fb); assert(pixels[8*64+8]==0xff0000ff); // The same alpha remains visible when explicitly used for a soft flash. assert(ac_gpu_begin(64,64,0,0,0)); assert(ac_gpu_theme_sprite(3,effect,0,0));ac_gpu_end(&fb); assert(((pixels[8*64+8]>>16)&255)==8); // Optional AIR sky is a retained opaque background with ordinary depth. fixture("/pieces/oskiewar-theme/sky-clouds-v1-1024x576.rgba",576,0); ac_gpu.theme_asset_retry_at[4]=0; assert(ac_gpu_theme_asset_ready(4)); double sky[]={0,0,ac_theme_master_widths[4],ac_theme_master_heights[4],32,32,64,64,0,.8}; assert(ac_gpu_begin(64,64,0,0,0)); assert(ac_gpu_theme_sprite(4,sky,0,1)); double behind[]={0,0,1,64,0,1,0,64,1,0,0,255}; ac_gpu_triangle(behind);ac_gpu_end(&fb); assert(pixels[8*64+8]==0xffff0000); // Sky writes depth and hides later distant geometry. assert(ac_gpu_begin(64,64,0,0,0)); assert(ac_gpu_theme_sprite(4,sky,0,1));ac_gpu_triangle(tri);ac_gpu_end(&fb); assert(pixels[8*64+8]==0xff0000ff); // Fighters remain in front of sky. assert(glGetError()==GL_NO_ERROR); puts("PASS theme orientation, retained uploads, optional assets, soft alpha, VFX/prop depth, bounds"); return 0; }