1 #pragma once 2 3 #include <wiiu/gx2/shaders.h> 4 5 /* incompatible with elf builds */ 6 /* #define GX2_CAN_ACCESS_DATA_SECTION */ 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 typedef union 13 __attribute__((aligned (16))) 14 { 15 struct __attribute__((scalar_storage_order ("little-endian"))) 16 { 17 float x; 18 float y; 19 }; 20 struct __attribute__((scalar_storage_order ("little-endian"))) 21 { 22 float width; 23 float height; 24 }; 25 }GX2_vec2; 26 27 typedef struct 28 __attribute__((aligned (16))) 29 __attribute__((scalar_storage_order ("little-endian"))) 30 { 31 float x; 32 float y; 33 union 34 { 35 struct __attribute__((scalar_storage_order ("little-endian"))) 36 { 37 float z; 38 float w; 39 }; 40 struct __attribute__((scalar_storage_order ("little-endian"))) 41 { 42 float width; 43 float height; 44 }; 45 }; 46 }GX2_vec4; 47 48 typedef union 49 { 50 struct 51 { 52 GX2_vec4 v0; 53 GX2_vec4 v1; 54 GX2_vec4 v2; 55 GX2_vec4 v3; 56 }; 57 struct __attribute__((scalar_storage_order ("little-endian"))) 58 { 59 float data[16]; 60 }; 61 }GX2_mat4x4; 62 63 typedef struct 64 { 65 GX2VertexShader vs; 66 GX2PixelShader ps; 67 GX2GeometryShader gs; 68 GX2FetchShader fs; 69 GX2AttribStream* attribute_stream; 70 }GX2Shader; 71 72 void GX2InitShader(GX2Shader* shader); 73 void GX2DestroyShader(GX2Shader* shader); 74 void GX2SetShader(GX2Shader* shader); 75 76 void check_shader(const void* shader_, u32 shader_size, const void* org_, u32 org_size, const char* name); 77 void check_shader_verbose(u32* shader, u32 shader_size, u32* org, u32 org_size, const char* name); 78 79 typedef struct 80 { 81 GX2VertexShader* vs; 82 GX2PixelShader* ps; 83 u8* data; 84 } GFDFile; 85 86 GFDFile* gfd_open(const char* filename); 87 void gfd_free(GFDFile* gfd); 88 89 #ifdef __cplusplus 90 } 91 #endif 92