mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Updated the sf2dlib and sftdlib; Added the gfx.color.hex() function; Added the New3DS CPU mode control.
As the color order of the sf2dlib changed, you have to change it in your code, or use the color.hex() function. To fix the problems, just change "0xRRGGBBAA" to "0xAABBGGRR". Also, the shader compiler changed to Picasso, so you'll need it in order to compile. https://github.com/fincs/picasso
This commit is contained in:
parent
0105970ab7
commit
b4d025d602
17 changed files with 205 additions and 131 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
|
||||
static int sf2d_initialized = 0;
|
||||
static u32 clear_color = RGBA8(0x00, 0x00, 0x00, 0xFF);
|
||||
static u32 clear_color = 0;
|
||||
static u32 *gpu_cmd = NULL;
|
||||
//GPU init variables
|
||||
static int gpu_cmd_size = 0;
|
||||
|
|
@ -193,8 +193,9 @@ void sf2d_end_frame()
|
|||
gspWaitForPPF();
|
||||
|
||||
//Clear the screen
|
||||
GX_SetMemoryFill(NULL, gpu_fb_addr, clear_color, &gpu_fb_addr[0x2EE00],
|
||||
0x201, gpu_depth_fb_addr, 0x00000000, &gpu_depth_fb_addr[0x2EE00], 0x201);
|
||||
GX_SetMemoryFill(NULL,
|
||||
gpu_fb_addr, clear_color, &gpu_fb_addr[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
|
||||
gpu_depth_fb_addr, 0, &gpu_depth_fb_addr[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH);
|
||||
gspWaitForPSC0();
|
||||
}
|
||||
|
||||
|
|
@ -245,6 +246,11 @@ void *sf2d_pool_memalign(u32 size, u32 alignment)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *sf2d_pool_calloc(u32 nmemb, u32 size)
|
||||
{
|
||||
return sf2d_pool_memalign(nmemb * size, size);
|
||||
}
|
||||
|
||||
unsigned int sf2d_pool_space_free()
|
||||
{
|
||||
return pool_size - pool_index;
|
||||
|
|
@ -257,7 +263,11 @@ void sf2d_pool_reset()
|
|||
|
||||
void sf2d_set_clear_color(u32 color)
|
||||
{
|
||||
clear_color = color;
|
||||
// GX_SetMemoryFill wants the color inverted?
|
||||
clear_color = RGBA8_GET_R(color) << 24 |
|
||||
RGBA8_GET_G(color) << 16 |
|
||||
RGBA8_GET_B(color) << 8 |
|
||||
RGBA8_GET_A(color) << 0;
|
||||
}
|
||||
|
||||
void sf2d_set_scissor_test(GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color)
|
||||
{
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_col));
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_col), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
vertices[0].position = (sf2d_vector_3f){(float)x0+1.0f, (float)y0+1.0f, SF2D_DEFAULT_DEPTH};
|
||||
|
|
@ -12,12 +12,7 @@ void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color)
|
|||
vertices[2].position = (sf2d_vector_3f){(float)x1+1.0f, (float)y1+1.0f, SF2D_DEFAULT_DEPTH};
|
||||
vertices[3].position = (sf2d_vector_3f){(float)x1-1.0f, (float)y1-1.0f, SF2D_DEFAULT_DEPTH};
|
||||
|
||||
u8 r = (color>>24) & 0xFF;
|
||||
u8 g = (color>>16) & 0xFF;
|
||||
u8 b = (color>>8) & 0xFF;
|
||||
u8 a = color & 0xFF;
|
||||
|
||||
vertices[0].color = (sf2d_vector_4f){r/255.0f, g/255.0f, b/255.0f, a/255.0f};
|
||||
vertices[0].color = color;
|
||||
vertices[1].color = vertices[0].color;
|
||||
vertices[2].color = vertices[0].color;
|
||||
vertices[3].color = vertices[0].color;
|
||||
|
|
@ -35,7 +30,7 @@ void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color)
|
|||
GPU_SetAttributeBuffers(
|
||||
2, // number of attributes
|
||||
(u32*)osConvertVirtToPhys((u32)vertices),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_FLOAT),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE),
|
||||
0xFFFC, //0b1100
|
||||
0x10,
|
||||
1, //number of buffers
|
||||
|
|
@ -49,7 +44,7 @@ void sf2d_draw_line(int x0, int y0, int x1, int y1, u32 color)
|
|||
|
||||
void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color)
|
||||
{
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_col));
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_col), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
vertices[0].position = (sf2d_vector_3f){(float)x, (float)y, SF2D_DEFAULT_DEPTH};
|
||||
|
|
@ -57,12 +52,7 @@ void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color)
|
|||
vertices[2].position = (sf2d_vector_3f){(float)x, (float)y+h, SF2D_DEFAULT_DEPTH};
|
||||
vertices[3].position = (sf2d_vector_3f){(float)x+w, (float)y+h, SF2D_DEFAULT_DEPTH};
|
||||
|
||||
u8 r = (color>>24) & 0xFF;
|
||||
u8 g = (color>>16) & 0xFF;
|
||||
u8 b = (color>>8) & 0xFF;
|
||||
u8 a = color & 0xFF;
|
||||
|
||||
vertices[0].color = (sf2d_vector_4f){r/255.0f, g/255.0f, b/255.0f, a/255.0f};
|
||||
vertices[0].color = color;
|
||||
vertices[1].color = vertices[0].color;
|
||||
vertices[2].color = vertices[0].color;
|
||||
vertices[3].color = vertices[0].color;
|
||||
|
|
@ -80,7 +70,7 @@ void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color)
|
|||
GPU_SetAttributeBuffers(
|
||||
2, // number of attributes
|
||||
(u32*)osConvertVirtToPhys((u32)vertices),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_FLOAT),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE),
|
||||
0xFFFC, //0b1100
|
||||
0x10,
|
||||
1, //number of buffers
|
||||
|
|
@ -94,7 +84,7 @@ void sf2d_draw_rectangle(int x, int y, int w, int h, u32 color)
|
|||
|
||||
void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad)
|
||||
{
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_col));
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_col), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
int w2 = w/2.0f;
|
||||
|
|
@ -105,12 +95,7 @@ void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad
|
|||
vertices[2].position = (sf2d_vector_3f){(float)-w2, (float) h2, SF2D_DEFAULT_DEPTH};
|
||||
vertices[3].position = (sf2d_vector_3f){(float) w2, (float) h2, SF2D_DEFAULT_DEPTH};
|
||||
|
||||
u8 r = (color>>24) & 0xFF;
|
||||
u8 g = (color>>16) & 0xFF;
|
||||
u8 b = (color>>8) & 0xFF;
|
||||
u8 a = color & 0xFF;
|
||||
|
||||
vertices[0].color = (sf2d_vector_4f){r/255.0f, g/255.0f, b/255.0f, a/255.0f};
|
||||
vertices[0].color = color;
|
||||
vertices[1].color = vertices[0].color;
|
||||
vertices[2].color = vertices[0].color;
|
||||
vertices[3].color = vertices[0].color;
|
||||
|
|
@ -138,7 +123,7 @@ void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad
|
|||
GPU_SetAttributeBuffers(
|
||||
2, // number of attributes
|
||||
(u32*)osConvertVirtToPhys((u32)vertices),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_FLOAT),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE),
|
||||
0xFFFC, //0b1100
|
||||
0x10,
|
||||
1, //number of buffers
|
||||
|
|
@ -153,17 +138,11 @@ void sf2d_draw_rectangle_rotate(int x, int y, int w, int h, u32 color, float rad
|
|||
void sf2d_draw_fill_circle(int x, int y, int radius, u32 color)
|
||||
{
|
||||
static const int num_segments = 100;
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_malloc((num_segments + 2) * sizeof(sf2d_vertex_pos_col));
|
||||
sf2d_vertex_pos_col *vertices = sf2d_pool_memalign((num_segments + 2) * sizeof(sf2d_vertex_pos_col), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
vertices[0].position = (sf2d_vector_3f){(float)x, (float)y, SF2D_DEFAULT_DEPTH};
|
||||
|
||||
u8 r = (color>>24) & 0xFF;
|
||||
u8 g = (color>>16) & 0xFF;
|
||||
u8 b = (color>>8) & 0xFF;
|
||||
u8 a = color & 0xFF;
|
||||
|
||||
vertices[0].color = (sf2d_vector_4f){r/255.0f, g/255.0f, b/255.0f, a/255.0f};
|
||||
vertices[0].color = color;
|
||||
|
||||
float theta = 2 * M_PI / (float)num_segments;
|
||||
float c = cosf(theta);
|
||||
|
|
@ -199,7 +178,7 @@ void sf2d_draw_fill_circle(int x, int y, int radius, u32 color)
|
|||
GPU_SetAttributeBuffers(
|
||||
2, // number of attributes
|
||||
(u32*)osConvertVirtToPhys((u32)vertices),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_FLOAT),
|
||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | GPU_ATTRIBFMT(1, 4, GPU_UNSIGNED_BYTE),
|
||||
0xFFFC, //0b1100
|
||||
0x10,
|
||||
1, //number of buffers
|
||||
|
|
|
|||
|
|
@ -24,16 +24,7 @@ void vector_mult_matrix4x4(const float *msrc, const sf2d_vector_3f *vsrc, sf2d_v
|
|||
|
||||
void matrix_gpu_set_uniform(const float *m, u32 startreg)
|
||||
{
|
||||
float mu[4*4];
|
||||
|
||||
int i, j;
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
mu[i*4 + j] = m[i*4 + (3-j)];
|
||||
}
|
||||
}
|
||||
|
||||
GPU_SetFloatUniform(GPU_VERTEX_SHADER, startreg, (u32 *)mu, 4);
|
||||
GPU_SetFloatUniform(GPU_VERTEX_SHADER, startreg, (u32 *)m, 4);
|
||||
}
|
||||
|
||||
void matrix_copy(float *dst, const float *src)
|
||||
|
|
@ -109,7 +100,7 @@ void matrix_swap_xy(float *m)
|
|||
void matrix_init_orthographic(float *m, float left, float right, float bottom, float top, float near, float far)
|
||||
{
|
||||
float mo[4*4], mp[4*4];
|
||||
|
||||
|
||||
mo[0x0] = 2.0f/(right-left);
|
||||
mo[0x1] = 0.0f;
|
||||
mo[0x2] = 0.0f;
|
||||
|
|
@ -129,7 +120,7 @@ void matrix_init_orthographic(float *m, float left, float right, float bottom, f
|
|||
mo[0xD] = 0.0f;
|
||||
mo[0xE] = 0.0f;
|
||||
mo[0xF] = 1.0f;
|
||||
|
||||
|
||||
matrix_identity4x4(mp);
|
||||
mp[0xA] = 0.5;
|
||||
mp[0xB] = -0.5;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@ sf2d_texture *sf2d_create_texture(int width, int height, sf2d_texfmt pixel_forma
|
|||
texture->tiled = 0;
|
||||
texture->place = place;
|
||||
texture->pixel_format = pixel_format;
|
||||
texture->params = GPU_TEXTURE_MAG_FILTER(GPU_NEAREST)
|
||||
| GPU_TEXTURE_MIN_FILTER(GPU_NEAREST)
|
||||
| GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_BORDER)
|
||||
| GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_BORDER);
|
||||
texture->width = width;
|
||||
texture->height = height;
|
||||
texture->pow2_w = pow2_w;
|
||||
|
|
@ -145,7 +149,7 @@ void sf2d_bind_texture(const sf2d_texture *texture, GPU_TEXUNIT unit)
|
|||
(u32 *)osConvertVirtToPhys((u32)texture->data),
|
||||
texture->pow2_w,
|
||||
texture->pow2_h,
|
||||
GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST),
|
||||
texture->params,
|
||||
texture->pixel_format
|
||||
);
|
||||
}
|
||||
|
|
@ -161,7 +165,7 @@ void sf2d_bind_texture_color(const sf2d_texture *texture, GPU_TEXUNIT unit, u32
|
|||
GPU_TEVOPERANDS(0, 0, 0),
|
||||
GPU_TEVOPERANDS(0, 0, 0),
|
||||
GPU_MODULATE, GPU_MODULATE,
|
||||
__builtin_bswap32(color) //RGBA8 -> ABGR8
|
||||
color
|
||||
);
|
||||
|
||||
GPU_SetTexture(
|
||||
|
|
@ -169,7 +173,7 @@ void sf2d_bind_texture_color(const sf2d_texture *texture, GPU_TEXUNIT unit, u32
|
|||
(u32 *)osConvertVirtToPhys((u32)texture->data),
|
||||
texture->pow2_w,
|
||||
texture->pow2_h,
|
||||
GPU_TEXTURE_MAG_FILTER(GPU_NEAREST) | GPU_TEXTURE_MIN_FILTER(GPU_NEAREST),
|
||||
texture->params,
|
||||
texture->pixel_format
|
||||
);
|
||||
}
|
||||
|
|
@ -198,9 +202,19 @@ void sf2d_bind_texture_parameters(const sf2d_texture *texture, GPU_TEXUNIT unit,
|
|||
);
|
||||
}
|
||||
|
||||
void sf2d_texture_set_params(sf2d_texture *texture, u32 params)
|
||||
{
|
||||
texture->params = params;
|
||||
}
|
||||
|
||||
int sf2d_texture_get_params(const sf2d_texture *texture)
|
||||
{
|
||||
return texture->params;
|
||||
}
|
||||
|
||||
static inline void sf2d_draw_texture_generic(const sf2d_texture *texture, int x, int y)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
int w = texture->width;
|
||||
|
|
@ -248,7 +262,7 @@ void sf2d_draw_texture_blend(const sf2d_texture *texture, int x, int y, u32 colo
|
|||
|
||||
static inline void sf2d_draw_texture_rotate_hotspot_generic(const sf2d_texture *texture, int x, int y, float rad, float center_x, float center_y)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
const float w = texture->width;
|
||||
|
|
@ -332,7 +346,7 @@ void sf2d_draw_texture_rotate_blend(const sf2d_texture *texture, int x, int y, f
|
|||
|
||||
static inline void sf2d_draw_texture_part_generic(const sf2d_texture *texture, int x, int y, int tex_x, int tex_y, int tex_w, int tex_h)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
vertices[0].position = (sf2d_vector_3f){(float)x, (float)y, SF2D_DEFAULT_DEPTH};
|
||||
|
|
@ -379,7 +393,7 @@ void sf2d_draw_texture_part_blend(const sf2d_texture *texture, int x, int y, int
|
|||
|
||||
static inline void sf2d_draw_texture_scale_generic(const sf2d_texture *texture, int x, int y, float x_scale, float y_scale)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
int ws = texture->width * x_scale;
|
||||
|
|
@ -427,7 +441,7 @@ void sf2d_draw_texture_scale_blend(const sf2d_texture *texture, int x, int y, fl
|
|||
|
||||
static inline void sf2d_draw_texture_part_scale_generic(const sf2d_texture *texture, float x, float y, float tex_x, float tex_y, float tex_w, float tex_h, float x_scale, float y_scale)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
float u0 = tex_x/(float)texture->pow2_w;
|
||||
|
|
@ -477,7 +491,7 @@ void sf2d_draw_texture_part_scale_blend(const sf2d_texture *texture, float x, fl
|
|||
|
||||
static inline void sf2d_draw_texture_part_rotate_scale_generic(const sf2d_texture *texture, int x, int y, float rad, int tex_x, int tex_y, int tex_w, int tex_h, float x_scale, float y_scale)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
int w2 = (tex_w * x_scale)/2.0f;
|
||||
|
|
@ -537,7 +551,7 @@ void sf2d_draw_texture_part_rotate_scale_blend(const sf2d_texture *texture, int
|
|||
|
||||
static inline void sf2d_draw_texture_depth_generic(const sf2d_texture *texture, int x, int y, signed short z)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
int w = texture->width;
|
||||
|
|
@ -587,7 +601,7 @@ void sf2d_draw_texture_depth_blend(const sf2d_texture *texture, int x, int y, si
|
|||
|
||||
void sf2d_draw_quad_uv(const sf2d_texture *texture, float left, float top, float right, float bottom, float u0, float v0, float u1, float v1, unsigned int params)
|
||||
{
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_malloc(4 * sizeof(sf2d_vertex_pos_tex));
|
||||
sf2d_vertex_pos_tex *vertices = sf2d_pool_memalign(4 * sizeof(sf2d_vertex_pos_tex), 8);
|
||||
if (!vertices) return;
|
||||
|
||||
vertices[0].position = (sf2d_vector_3f){left, top, SF2D_DEFAULT_DEPTH};
|
||||
|
|
@ -641,9 +655,9 @@ void sf2d_set_pixel(sf2d_texture *texture, int x, int y, u32 new_color)
|
|||
if (texture->tiled) {
|
||||
u32 coarse_y = y & ~7;
|
||||
u32 offset = get_morton_offset(x, y, 4) + coarse_y * texture->pow2_w * 4;
|
||||
*(u32 *)(texture->data + offset) = __builtin_bswap32(new_color);
|
||||
*(u32 *)(texture->data + offset) = new_color;
|
||||
} else {
|
||||
((u32 *)texture->data)[x + y * texture->pow2_w] = __builtin_bswap32(new_color);
|
||||
((u32 *)texture->data)[x + y * texture->pow2_w] = new_color;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -653,9 +667,9 @@ u32 sf2d_get_pixel(sf2d_texture *texture, int x, int y)
|
|||
if (texture->tiled) {
|
||||
u32 coarse_y = y & ~7;
|
||||
u32 offset = get_morton_offset(x, y, 4) + coarse_y * texture->pow2_w * 4;
|
||||
return __builtin_bswap32(*(u32 *)(texture->data + offset));
|
||||
return *(u32 *)(texture->data + offset);
|
||||
} else {
|
||||
return __builtin_bswap32(((u32 *)texture->data)[x + y * texture->pow2_w]);
|
||||
return ((u32 *)texture->data)[x + y * texture->pow2_w];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -675,7 +689,7 @@ void sf2d_texture_tile32(sf2d_texture *texture)
|
|||
u32 dst_offset = get_morton_offset(i, j, 4) + coarse_y * texture->pow2_w * 4;
|
||||
|
||||
u32 v = ((u32 *)texture->data)[i + (texture->pow2_h - 1 - j)*texture->pow2_w];
|
||||
*(u32 *)(tmp + dst_offset) = __builtin_bswap32(v);
|
||||
*(u32 *)(tmp + dst_offset) = __builtin_bswap32(v); /* RGBA8 -> ABGR8 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue