ggl_context.h
来自「Android 一些工具」· C头文件 代码 · 共 543 行 · 第 1/2 页
H
543 行
GGLclampx r; GGLclampx g; GGLclampx b; GGLclampx a; GGLclampx depth; GGLint stencil; uint32_t colorPacked; uint32_t depthPacked; uint32_t stencilPacked; uint32_t dirty;};struct fog_state_t { uint8_t color[3]; uint8_t reserved;};struct logic_op_state_t { uint16_t opcode;};struct alpha_test_state_t { uint16_t func; GGLcolor ref;};struct depth_test_state_t { uint16_t func; GGLclampx clearValue;};struct scissor_t { uint32_t user_left; uint32_t user_right; uint32_t user_top; uint32_t user_bottom; uint32_t left; uint32_t right; uint32_t top; uint32_t bottom;};struct pixel_t { uint32_t c[4]; uint8_t s[4];};struct surface_t { union { GGLSurface s; struct { uint32_t reserved; uint32_t width; uint32_t height; int32_t stride; uint8_t* data; uint8_t format; uint8_t dirty; uint8_t pad[2]; }; }; void (*read) (const surface_t* s, context_t* c, uint32_t x, uint32_t y, pixel_t* pixel); void (*write)(const surface_t* s, context_t* c, uint32_t x, uint32_t y, const pixel_t* pixel);};// ----------------------------------------------------------------------------struct texture_shade_t { union { struct { int32_t is0; int32_t idsdx; int32_t idsdy; int sscale; int32_t it0; int32_t idtdx; int32_t idtdy; int tscale; }; struct { int32_t v; int32_t dx; int32_t dy; int scale; } st[2]; };};struct texture_iterators_t { // these are not encoded in the same way than in the // texture_shade_t structure union { struct { GGLfixed ydsdy; GGLfixed dsdx; GGLfixed dsdy; int sscale; GGLfixed ydtdy; GGLfixed dtdx; GGLfixed dtdy; int tscale; }; struct { GGLfixed ydvdy; GGLfixed dvdx; GGLfixed dvdy; int scale; } st[2]; };};struct texture_t { surface_t surface; texture_iterators_t iterators; texture_shade_t shade; uint32_t s_coord; uint32_t t_coord; uint16_t s_wrap; uint16_t t_wrap; uint16_t min_filter; uint16_t mag_filter; uint16_t env; uint8_t env_color[4]; uint8_t enable; uint8_t dirty;};struct raster_t { GGLfixed x; GGLfixed y;};struct framebuffer_t { surface_t color; surface_t read; surface_t depth; surface_t stencil; int16_t *coverage; size_t coverageBufferSize;};// ----------------------------------------------------------------------------struct iterators_t { int32_t xl; int32_t xr; int32_t y; GGLcolor ydady; GGLcolor ydrdy; GGLcolor ydgdy; GGLcolor ydbdy; GGLfixed ydzdy; GGLfixed ydwdy; GGLfixed ydfdy;};struct shade_t { GGLcolor a0; GGLcolor dadx; GGLcolor dady; GGLcolor r0; GGLcolor drdx; GGLcolor drdy; GGLcolor g0; GGLcolor dgdx; GGLcolor dgdy; GGLcolor b0; GGLcolor dbdx; GGLcolor dbdy; uint32_t z0; GGLfixed32 dzdx; GGLfixed32 dzdy; GGLfixed w0; GGLfixed dwdx; GGLfixed dwdy; uint32_t f0; GGLfixed dfdx; GGLfixed dfdy;};// these are used in the generated code// we use this mirror structure to improve// data locality in the pixel pipelinestruct generated_tex_vars_t { uint32_t width; uint32_t height; uint32_t stride; int32_t data; int32_t dsdx; int32_t dtdx; int32_t spill[2];};struct generated_vars_t { struct { int32_t c; int32_t dx; } argb[4]; int32_t aref; int32_t dzdx; int32_t zbase; int32_t f; int32_t dfdx; int32_t spill[3]; generated_tex_vars_t texture[GGL_TEXTURE_UNIT_COUNT]; int32_t rt; int32_t lb;};// ----------------------------------------------------------------------------struct state_t { framebuffer_t buffers; texture_t texture[GGL_TEXTURE_UNIT_COUNT]; scissor_t scissor; raster_t raster; blend_state_t blend; alpha_test_state_t alpha_test; depth_test_state_t depth_test; mask_state_t mask; clear_state_t clear; fog_state_t fog; logic_op_state_t logic_op; uint32_t enables; uint32_t enabled_tmu; needs_t needs;};// ----------------------------------------------------------------------------struct context_t { GGLContext procs; state_t state; shade_t shade; iterators_t iterators; generated_vars_t generated_vars __attribute__((aligned(32))); uint8_t ditherMatrix[GGL_DITHER_SIZE] __attribute__((aligned(32))); uint32_t packed; uint32_t packed8888; const GGLFormat* formats; uint32_t dirty; texture_t* activeTMU; uint32_t activeTMUIndex; void (*init_y)(context_t* c, int32_t y); void (*step_y)(context_t* c); void (*scanline)(context_t* c); void (*span)(context_t* c); void (*rect)(context_t* c, size_t yc); void* base; Assembly* scanline_as; GGLenum error;};// ----------------------------------------------------------------------------void ggl_init_context(context_t* context);void ggl_uninit_context(context_t* context);void ggl_error(context_t* c, GGLenum error);int64_t ggl_system_time();// ----------------------------------------------------------------------------};#endif // ANDROID_GGL_CONTEXT_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?