(WIIU) add remaining menu shaders.

- move some files around.
This commit is contained in:
aliaspider 2018-01-12 02:54:45 +01:00
parent 9c2fc061ee
commit 24cb240079
31 changed files with 5280 additions and 82 deletions

View File

@ -75,10 +75,15 @@ else
OBJ += wiiu/system/missing_libc_functions.o
OBJ += wiiu/shader_utils.o
OBJ += wiiu/tex_shader.o
OBJ += wiiu/sprite_shader.o
OBJ += wiiu/frame_shader.o
OBJ += wiiu/ribbon_shader.o
OBJ += gfx/drivers/gx2_shaders/tex.o
OBJ += gfx/drivers/gx2_shaders/sprite.o
OBJ += gfx/drivers/gx2_shaders/frame.o
OBJ += gfx/drivers/gx2_shaders/ribbon.o
OBJ += gfx/drivers/gx2_shaders/ribbon_simple.o
OBJ += gfx/drivers/gx2_shaders/bokeh.o
OBJ += gfx/drivers/gx2_shaders/snow.o
OBJ += gfx/drivers/gx2_shaders/snow_simple.o
OBJ += gfx/drivers/gx2_shaders/snowflake.o
OBJ += gfx/drivers_shader/slang_preprocess.o
OBJ += gfx/drivers_shader/glslang_util.o
@ -124,7 +129,7 @@ else
BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
OBJ += gfx/drivers/wiiu_gfx.o
OBJ += gfx/drivers/gx2_gfx.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o

View File

@ -2,10 +2,10 @@
#include <wiiu/gx2.h>
#include "wiiu/frame_shader.h"
#include "wiiu/tex_shader.h"
#include "wiiu/sprite_shader.h"
#include "wiiu/ribbon_shader.h"
#include "gfx/drivers/gx2_shaders/frame.h"
#include "gfx/drivers/gx2_shaders/tex.h"
#include "gfx/drivers/gx2_shaders/sprite.h"
#include "gfx/drivers/gx2_shaders/menu_shaders.h"
#include "gfx/video_shader_parse.h"
#undef _X
@ -74,8 +74,8 @@ typedef struct
int width;
int height;
float* menu_display_coord_array;
ribbon_uniform_t* ribbon_ubo;
float* menu_shader_vbo;
menu_shader_uniform_t* menu_shader_ubo;
struct
{

View File

@ -286,7 +286,13 @@ static void *wiiu_gfx_init(const video_info_t *video,
GX2InitShader(&frame_shader);
GX2InitShader(&tex_shader);
GX2InitShader(&sprite_shader);
GX2InitShader(&ribbon_simple_shader);
GX2InitShader(&ribbon_shader);
GX2InitShader(&bokeh_shader);
GX2InitShader(&snow_shader);
GX2InitShader(&snow_simple_shader);
GX2InitShader(&snowflake_shader);
GX2SetShader(&frame_shader);
wiiu->ubo_vp = MEM1_alloc(sizeof(*wiiu->ubo_vp), GX2_UNIFORM_BLOCK_ALIGNMENT);
@ -665,7 +671,13 @@ static void wiiu_gfx_free(void *data)
GX2DestroyShader(&frame_shader);
GX2DestroyShader(&tex_shader);
GX2DestroyShader(&sprite_shader);
GX2DestroyShader(&ribbon_simple_shader);
GX2DestroyShader(&ribbon_shader);
GX2DestroyShader(&bokeh_shader);
GX2DestroyShader(&snow_shader);
GX2DestroyShader(&snow_simple_shader);
GX2DestroyShader(&snowflake_shader);
wiiu_free_shader_preset(wiiu);
#ifdef HAVE_OVERLAY
@ -680,8 +692,8 @@ static void wiiu_gfx_free(void *data)
MEM2_free(wiiu->menu.v);
MEM2_free(wiiu->vertex_cache.v);
MEM2_free(wiiu->vertex_cache_tex.v);
MEM2_free(wiiu->menu_display_coord_array);
MEM2_free(wiiu->ribbon_ubo);
MEM2_free(wiiu->menu_shader_vbo);
MEM2_free(wiiu->menu_shader_ubo);
MEM1_free(wiiu->color_buffer.surface.image);
MEM1_free(wiiu->ubo_vp);

View File

@ -0,0 +1,801 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2014-2018 - Ali Bouhlel
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "gx2_shader_inl.h"
#include "menu_shaders.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
{
u64 cf[32];
u64 alu[16];
} vs_program =
{
{
CALL_FS NO_BARRIER,
ALU(32,16) KCACHE0(CB1, _0_15),
EXP_DONE(POS0, _R1,_x,_y,_z,_w),
EXP_DONE(PARAM0, _R0,_m,_m,_m,_m)
END_OF_PROGRAM
},
{
/* 0 */
ALU_MUL(__,_x, _R1,_w, KC0(3),_w),
ALU_MUL(__,_y, _R1,_w, KC0(3),_z),
ALU_MUL(__,_z, _R1,_w, KC0(3),_y),
ALU_MUL(__,_w, _R1,_w, KC0(3),_x)
ALU_LAST,
/* 1 */
ALU_MULADD(_R123,_x, _R1,_z, KC0(2),_w, ALU_SRC_PV,_x),
ALU_MULADD(_R123,_y, _R1,_z, KC0(2),_z, ALU_SRC_PV,_y),
ALU_MULADD(_R123,_z, _R1,_z, KC0(2),_y, ALU_SRC_PV,_z),
ALU_MULADD(_R123,_w, _R1,_z, KC0(2),_x, ALU_SRC_PV,_w)
ALU_LAST,
/* 2 */
ALU_MULADD(_R123,_x, _R1,_y, KC0(1),_w, ALU_SRC_PV,_x),
ALU_MULADD(_R123,_y, _R1,_y, KC0(1),_z, ALU_SRC_PV,_y),
ALU_MULADD(_R123,_z, _R1,_y, KC0(1),_y, ALU_SRC_PV,_z),
ALU_MULADD(_R123,_w, _R1,_y, KC0(1),_x, ALU_SRC_PV,_w)
ALU_LAST,
/* 3 */
ALU_MULADD(_R1,_x, _R1,_x, KC0(0),_x, ALU_SRC_PV,_w),
ALU_MULADD(_R1,_y, _R1,_x, KC0(0),_y, ALU_SRC_PV,_z),
ALU_MULADD(_R1,_z, _R1,_x, KC0(0),_z, ALU_SRC_PV,_y),
ALU_MULADD(_R1,_w, _R1,_x, KC0(0),_w, ALU_SRC_PV,_x)
ALU_LAST,
},
};
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
{
u64 cf[32];
u64 alu[70];
u64 alu1[19];
u64 alu2[31];
u64 alu3[25];
u64 alu4[31];
u64 alu5[25];
u64 alu6[31];
u64 alu7[25];
u64 alu8[31];
u64 alu9[25];
u64 alu10[31];
u64 alu11[25];
u64 alu12[17];
} ps_program =
{
{
ALU_PUSH_BEFORE(32,70) KCACHE0(CB1, _0_15),
JUMP(1, 3) VALID_PIX,
ALU_POP_AFTER(102,19),
ALU_PUSH_BEFORE(121,31) KCACHE0(CB1, _0_15),
JUMP(1, 6) VALID_PIX,
ALU_POP_AFTER(152,25),
ALU_PUSH_BEFORE(177,31) KCACHE0(CB1, _0_15),
JUMP(1, 9) VALID_PIX,
ALU_POP_AFTER(208,25),
ALU_PUSH_BEFORE(233,31) KCACHE0(CB1, _0_15),
JUMP(1, 12) VALID_PIX,
ALU_POP_AFTER(264,25),
ALU_PUSH_BEFORE(289,31) KCACHE0(CB1, _0_15),
JUMP(1, 15) VALID_PIX,
ALU_POP_AFTER(320,25),
ALU_PUSH_BEFORE(345,31) KCACHE0(CB1, _0_15),
JUMP(1, 18) VALID_PIX,
ALU_POP_AFTER(376,25),
ALU(401,17),
EXP_DONE(PIX0, _R0,_x,_y,_z,_w)
END_OF_PROGRAM
},
{
/* 0 */
ALU_MOV_x2(__,_x, _R0,_x),
ALU_MOV_x4(__,_y, KC0(5),_x),
ALU_MUL(_R127,_z, KC0(4),_x, ALU_SRC_LITERAL,_x),
ALU_MOV_x2(_R127,_w, _R0,_y),
ALU_RECIP_IEEE(__,_x, KC0(4),_x) SCL_210
ALU_LAST,
ALU_LITERAL(0xBF517A97),
/* 1 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x),
ALU_MUL_IEEE(__,_y, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y),
ALU_MUL_IEEE(__,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z),
ALU_MUL_IEEE(_R1,_w, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_w),
ALU_MUL_IEEE(_R127,_x, ALU_SRC_PV,_x, ALU_SRC_PS,_x)
ALU_LAST,
ALU_LITERAL4(0x3DE38E39, 0x3E124925, 0x3E2AAAAB, 0x3D888889),
/* 2 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_ADD(__,_y, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_w),
ALU_MUL(_R2,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z),
ALU_MULADD(_R126,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_RECIP_IEEE(__,_x, KC0(4),_y) SCL_210
ALU_LAST,
ALU_LITERAL3(0x3E22F983, 0x3F6BB554, 0x3E99999A),
/* 3 */
ALU_MUL_IEEE(_R126,_x, _R127,_w, ALU_SRC_PS,_x),
ALU_FRACT(_R127,_y, ALU_SRC_PV,_x),
ALU_ADD(__,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_y),
ALU_MULADD(_R127,_w, ALU_SRC_LITERAL,_z, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_y),
ALU_RECIP_IEEE(_R3,_z, KC0(4),_y) SCL_210
ALU_LAST,
ALU_LITERAL3(0x343F0981, 0x3F6BB554, 0x3E4CCCD7),
/* 4 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_MUL_IEEE(_R126,_y, ALU_SRC_PS,_x, _R127,_z),
ALU_FRACT(_R127,_z, _R126,_w),
ALU_MUL_IEEE(__,_w, KC0(4),_x, ALU_SRC_PS,_x),
ALU_ADD(_R0,_x, _R127,_x, ALU_SRC_1 _NEG,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 5 */
ALU_MUL(_R0,_x, ALU_SRC_PS,_x, ALU_SRC_PV,_w),
ALU_FRACT(__,_y, _R127,_w),
ALU_MULADD(_R126,_z, _R127,_y, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_FRACT(__,_w, ALU_SRC_PV,_x),
ALU_ADD(_R2,_y, _R126,_x, ALU_SRC_1 _NEG,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 6 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_w, ALU_SRC_LITERAL,_z),
ALU_MOV(_R127,_z, ALU_SRC_0,_x),
ALU_MULADD(_R123,_w, _R127,_z, ALU_SRC_LITERAL,_w, ALU_SRC_LITERAL,_z),
ALU_MOV(_R4,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL4(0xBFA64605, 0x40264605, 0xC0490FDB, 0x40C90FDB),
/* 7 */
ALU_MUL(_R126,_x, _R126,_z, ALU_SRC_LITERAL,_x),
ALU_ADD(_R127,_y, _R2,_y, ALU_SRC_PV _NEG,_x),
ALU_MUL(__,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x),
ALU_MUL(_R127,_w, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x),
ALU_MOV(_R4,_y, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 8 */
ALU_MOV(_R4,_z, ALU_SRC_0,_x),
ALU_SIN(__,_z, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 9 */
ALU_ADD(__,_z, _R126,_y, ALU_SRC_PS,_x),
ALU_SIN(_R126,_w, _R126,_x) SCL_210
ALU_LAST,
/* 10 */
ALU_ADD(__,_x, _R0,_x, ALU_SRC_PV _NEG,_z),
ALU_SIN(_R126,_z, _R127,_w) SCL_210
ALU_LAST,
/* 11 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_DOT4(__,_y, _R127,_y, _R127,_y),
ALU_DOT4(__,_z, _R127,_z, _R127,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x),
ALU_MULADD(_R1,_x, _R126,_w, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x80000000, 0x3E99999A, 0x3E46A7F0),
/* 12 */
ALU_MULADD(_R2,_x, _R126,_z, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_SQRT_IEEE(_R0,_y, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
ALU_LITERAL2(0x3E99999A, 0x3F8CCCCD),
/* 13 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_y) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3E991815),
},
{
/* 14 */
ALU_ADD_D2(_R127,_x, _R2,_x, _R1,_x),
ALU_MOV(_R0,_y, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_y, ALU_SRC_LITERAL,_z),
ALU_MOV(_R1,_y, ALU_SRC_LITERAL,_w)
ALU_LAST,
ALU_LITERAL4(0x3E4CCCCD, 0x3E8D6CCC, 0xBD37B680, 0x3E3C9110),
/* 15 */
ALU_ADD_D2(_R127,_y, ALU_SRC_PS,_x, ALU_SRC_PV,_y),
ALU_MUL_IEEE(__,_z, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x) CLAMP,
ALU_MOV(_R1,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL2(0x407BCF50, 0x3ECCCCCD),
/* 16 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_z, ALU_SRC_PV,_z),
ALU_ADD_D2(_R127,_z, ALU_SRC_PS,_x, _R0,_z)
ALU_LAST,
ALU_LITERAL2(0x40400000, 0xC0000000),
/* 17 */
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
/* 18 */
ALU_MULADD(_R4,_x, _R127,_z, ALU_SRC_PV,_w, ALU_SRC_0,_x),
ALU_MULADD(_R4,_y, _R127,_y, ALU_SRC_PV,_w, ALU_SRC_0,_x),
ALU_MULADD(_R4,_z, _R127,_x, ALU_SRC_PV,_w, ALU_SRC_0,_x)
ALU_LAST,
},
{
/* 19 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, _R2,_z, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, KC0(4),_x, ALU_SRC_LITERAL,_z),
ALU_MOV(_R127,_z, ALU_SRC_0,_x),
ALU_ADD(__,_w, ALU_SRC_LITERAL,_x, _R1,_w)
ALU_LAST,
ALU_LITERAL3(0x3F3C8F80, 0x3E67F55C, 0xBF614144),
/* 20 */
ALU_MUL_IEEE(_R127,_x, _R3,_z, ALU_SRC_PV,_y),
ALU_ADD(__,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_w),
ALU_FRACT(__,_w, ALU_SRC_PV,_x)
ALU_LAST,
ALU_LITERAL(0x3D07CACC),
/* 21 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_z, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL3(0xBFA5310B, 0x4025310B, 0x3E22F983),
/* 22 */
ALU_FRACT(__,_x, ALU_SRC_PV,_y),
ALU_ADD(_R127,_y, _R2,_y, ALU_SRC_PV _NEG,_x)
ALU_LAST,
/* 23 */
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 24 */
ALU_MUL(__,_z, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 25 */
ALU_SIN(__,_x, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 26 */
ALU_ADD(__,_z, _R127,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 27 */
ALU_ADD(__,_x, _R0,_x, ALU_SRC_PV _NEG,_z)
ALU_LAST,
/* 28 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_DOT4(__,_y, _R127,_y, _R127,_y),
ALU_DOT4(__,_z, _R127,_z, _R127,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x80000000),
/* 29 */
ALU_SQRT_IEEE(_R0,_w, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 30 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_w) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3E94C42C),
},
{
/* 31 */
ALU_ADD(__,_x, _R1 _NEG,_x, _R2,_x),
ALU_MOV(_R0,_y, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_w, ALU_SRC_LITERAL,_z),
ALU_MOV(_R1,_y, ALU_SRC_LITERAL,_w)
ALU_LAST,
ALU_LITERAL4(0x3E4CCCCD, 0x3E6245CD, 0xBD328502, 0x3E16D933),
/* 32 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x) CLAMP,
ALU_ADD(__,_y, ALU_SRC_PV _NEG,_y, ALU_SRC_PS,_x),
ALU_MOV(_R1,_z, ALU_SRC_LITERAL,_y),
ALU_MULADD(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, _R1,_x)
ALU_LAST,
ALU_LITERAL3(0x4081914F, 0x3ECCCCCD, 0x3F6BB554),
/* 33 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_MULADD(_R127,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, _R0,_y),
ALU_ADD(__,_w, _R0 _NEG,_z, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL3(0x40400000, 0xC0000000, 0x3F6BB554),
/* 34 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, _R0,_z),
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
ALU_LITERAL(0x3F6BB554),
/* 35 */
ALU_MULADD(_R4,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_w, _R4,_x),
ALU_MULADD(_R4,_y, _R127,_z, ALU_SRC_PV,_w, _R4,_y),
ALU_MULADD(_R4,_z, _R127,_w, ALU_SRC_PV,_w, _R4,_z)
ALU_LAST,
},
{
/* 36 */
ALU_MUL(__,_x, KC0(4),_x, ALU_SRC_LITERAL,_x),
ALU_ADD(__,_y, ALU_SRC_LITERAL,_y, _R1,_w),
ALU_MOV(_R127,_z, ALU_SRC_0,_x),
ALU_MULADD(_R123,_w, ALU_SRC_LITERAL,_z, _R2,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3D025A9D, 0x3EFC57D8, 0x3F7FFDB3),
/* 37 */
ALU_FRACT(__,_y, ALU_SRC_PV,_w),
ALU_ADD(__,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_y),
ALU_MUL_IEEE(_R127,_w, _R3,_z, ALU_SRC_PV,_x)
ALU_LAST,
ALU_LITERAL(0x3F7FFD20),
/* 38 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3E22F983, 0xBFECB330, 0x406CB330),
/* 39 */
ALU_ADD(_R127,_y, _R2,_y, ALU_SRC_PV _NEG,_w),
ALU_FRACT(__,_w, ALU_SRC_PV,_x)
ALU_LAST,
/* 40 */
ALU_MULADD(_R123,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 41 */
ALU_MUL(__,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 42 */
ALU_SIN(__,_x, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 43 */
ALU_ADD(__,_z, _R127,_w, ALU_SRC_PS,_x)
ALU_LAST,
/* 44 */
ALU_ADD(__,_x, _R0,_x, ALU_SRC_PV _NEG,_z)
ALU_LAST,
/* 45 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_DOT4(__,_y, _R127,_y, _R127,_y),
ALU_DOT4(__,_z, _R127,_z, _R127,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x80000000),
/* 46 */
ALU_SQRT_IEEE(_R0,_y, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 47 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_y) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3F59665F),
},
{
/* 48 */
ALU_ADD(__,_x, _R1 _NEG,_x, _R2,_x),
ALU_MOV(_R0,_y, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_y, ALU_SRC_LITERAL,_z),
ALU_MOV(_R1,_y, ALU_SRC_LITERAL,_w)
ALU_LAST,
ALU_LITERAL4(0x3E4CCCCD, 0x3E1767E8, 0xBE0270A0, 0x3DC9DFE0),
/* 49 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x) CLAMP,
ALU_ADD(__,_y, ALU_SRC_PV _NEG,_y, ALU_SRC_PS,_x),
ALU_MOV(_R1,_z, ALU_SRC_LITERAL,_y),
ALU_MULADD(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, _R1,_x)
ALU_LAST,
ALU_LITERAL3(0x3FB15362, 0x3ECCCCCD, 0x3F7463DB),
/* 50 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_MULADD(_R127,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, _R0,_y),
ALU_ADD(__,_w, _R0 _NEG,_z, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL3(0x40400000, 0xC0000000, 0x3F7463DB),
/* 51 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, _R0,_z),
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
ALU_LITERAL(0x3F7463DB),
/* 52 */
ALU_MULADD(_R4,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_w, _R4,_x),
ALU_MULADD(_R4,_y, _R127,_z, ALU_SRC_PV,_w, _R4,_y),
ALU_MULADD(_R4,_z, _R127,_w, ALU_SRC_PV,_w, _R4,_z)
ALU_LAST,
},
{
/* 53 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, _R2,_z, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, KC0(4),_x, ALU_SRC_LITERAL,_z),
ALU_MOV(_R127,_z, ALU_SRC_0,_x),
ALU_ADD(__,_w, ALU_SRC_LITERAL,_x, _R1,_w)
ALU_LAST,
ALU_LITERAL3(0x3E807F0A, 0x3E69ABCD, 0x3F688ACD),
/* 54 */
ALU_MUL_IEEE(_R127,_x, _R3,_z, ALU_SRC_PV,_y),
ALU_ADD(__,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_w),
ALU_FRACT(__,_w, ALU_SRC_PV,_x)
ALU_LAST,
ALU_LITERAL(0x3D105B00),
/* 55 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_z, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL3(0xBF9816FE, 0x401816FE, 0x3E22F983),
/* 56 */
ALU_FRACT(__,_x, ALU_SRC_PV,_y),
ALU_ADD(_R127,_y, _R2,_y, ALU_SRC_PV _NEG,_x)
ALU_LAST,
/* 57 */
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 58 */
ALU_MUL(__,_z, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 59 */
ALU_SIN(__,_x, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 60 */
ALU_ADD(__,_z, _R127,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 61 */
ALU_ADD(__,_x, _R0,_x, ALU_SRC_PV _NEG,_z)
ALU_LAST,
/* 62 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_DOT4(__,_y, _R127,_y, _R127,_y),
ALU_DOT4(__,_z, _R127,_z, _R127,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x80000000),
/* 63 */
ALU_SQRT_IEEE(_R0,_w, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 64 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_w) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3E40B7F0),
},
{
/* 65 */
ALU_ADD(__,_x, _R1 _NEG,_x, _R2,_x),
ALU_MOV(_R0,_y, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_w, ALU_SRC_LITERAL,_z),
ALU_MOV(_R1,_y, ALU_SRC_LITERAL,_w)
ALU_LAST,
ALU_LITERAL4(0x3E4CCCCD, 0x3D9A320C, 0xBCE74321, 0x3D4D9810),
/* 66 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x) CLAMP,
ALU_ADD(__,_y, ALU_SRC_PV _NEG,_y, ALU_SRC_PS,_x),
ALU_MOV(_R1,_z, ALU_SRC_LITERAL,_y),
ALU_MULADD(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, _R1,_x)
ALU_LAST,
ALU_LITERAL3(0x40C80926, 0x3ECCCCCD, 0x3F12103A),
/* 67 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_MULADD(_R127,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, _R0,_y),
ALU_ADD(__,_w, _R0 _NEG,_z, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL3(0x40400000, 0xC0000000, 0x3F12103A),
/* 68 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, _R0,_z),
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
ALU_LITERAL(0x3F12103A),
/* 69 */
ALU_MULADD(_R4,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_w, _R4,_x),
ALU_MULADD(_R4,_y, _R127,_z, ALU_SRC_PV,_w, _R4,_y),
ALU_MULADD(_R4,_z, _R127,_w, ALU_SRC_PV,_w, _R4,_z)
ALU_LAST,
},
{
/* 70 */
ALU_MUL(__,_x, KC0(4),_x, ALU_SRC_LITERAL,_x),
ALU_ADD(__,_y, ALU_SRC_LITERAL,_y, _R1,_w),
ALU_MOV(_R127,_z, ALU_SRC_0,_x),
ALU_MULADD(_R123,_w, ALU_SRC_LITERAL,_z, _R2,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3F47AF3F, 0x3D92E648, 0x3E4CCCD4),
/* 71 */
ALU_FRACT(__,_y, ALU_SRC_PV,_w),
ALU_ADD(__,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_y),
ALU_MUL_IEEE(_R127,_w, _R3,_z, ALU_SRC_PV,_x)
ALU_LAST,
ALU_LITERAL(0x34036F48),
/* 72 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3E22F983, 0xBF8F17E6, 0x400F17E6),
/* 73 */
ALU_ADD(_R127,_y, _R2,_y, ALU_SRC_PV _NEG,_w),
ALU_FRACT(__,_w, ALU_SRC_PV,_x)
ALU_LAST,
/* 74 */
ALU_MULADD(_R123,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 75 */
ALU_MUL(__,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 76 */
ALU_SIN(__,_x, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 77 */
ALU_ADD(__,_z, _R127,_w, ALU_SRC_PS,_x)
ALU_LAST,
/* 78 */
ALU_ADD(__,_x, _R0,_x, ALU_SRC_PV _NEG,_z)
ALU_LAST,
/* 79 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_DOT4(__,_y, _R127,_y, _R127,_y),
ALU_DOT4(__,_z, _R127,_z, _R127,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x80000000),
/* 80 */
ALU_SQRT_IEEE(_R0,_y, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 81 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_y) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3DF17E5E),
},
{
/* 82 */
ALU_ADD(__,_x, _R1 _NEG,_x, _R2,_x),
ALU_MOV(_R0,_y, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_y, ALU_SRC_LITERAL,_z),
ALU_MOV(_R1,_y, ALU_SRC_LITERAL,_w)
ALU_LAST,
ALU_LITERAL4(0x3E4CCCCD, 0x3CB0478A, 0xBC90E56C, 0x3C6B0A0D),
/* 83 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x) CLAMP,
ALU_ADD(__,_y, ALU_SRC_PV _NEG,_y, ALU_SRC_PS,_x),
ALU_MOV(_R1,_z, ALU_SRC_LITERAL,_y),
ALU_MULADD(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, _R1,_x)
ALU_LAST,
ALU_LITERAL3(0x411FA24D, 0x3ECCCCCD, 0x3DF908C0),
/* 84 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_MULADD(_R127,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, _R0,_y),
ALU_ADD(__,_w, _R0 _NEG,_z, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL3(0x40400000, 0xC0000000, 0x3DF908C0),
/* 85 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, _R0,_z),
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
ALU_LITERAL(0x3DF908C0),
/* 86 */
ALU_MULADD(_R4,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_w, _R4,_x),
ALU_MULADD(_R4,_y, _R127,_z, ALU_SRC_PV,_w, _R4,_y),
ALU_MULADD(_R4,_z, _R127,_w, ALU_SRC_PV,_w, _R4,_z)
ALU_LAST,
},
{
/* 87 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, _R2,_z, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, KC0(4),_x, ALU_SRC_LITERAL,_z),
ALU_MOV(_R127,_z, ALU_SRC_0,_x),
ALU_ADD(__,_w, ALU_SRC_LITERAL,_x, _R1,_w)
ALU_LAST,
ALU_LITERAL3(0x399F9C00, 0x3EC9A118, 0xBE584E5C),
/* 88 */
ALU_MUL_IEEE(_R127,_x, _R3,_z, ALU_SRC_PV,_y),
ALU_ADD(__,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_w),
ALU_FRACT(__,_w, ALU_SRC_PV,_x)
ALU_LAST,
ALU_LITERAL(0x3E7812BA),
/* 89 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_z, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL3(0xBFA3FD9F, 0x4023FD9F, 0x3E22F983),
/* 90 */
ALU_FRACT(__,_x, ALU_SRC_PV,_y),
ALU_ADD(_R127,_y, _R2,_y, ALU_SRC_PV _NEG,_x)
ALU_LAST,
/* 91 */
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 92 */
ALU_MUL(__,_z, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 93 */
ALU_SIN(__,_x, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 94 */
ALU_ADD(__,_z, _R127,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 95 */
ALU_ADD(__,_x, _R0,_x, ALU_SRC_PV _NEG,_z)
ALU_LAST,
/* 96 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_DOT4(__,_y, _R127,_y, _R127,_y),
ALU_DOT4(__,_z, _R127,_z, _R127,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x80000000),
/* 97 */
ALU_SQRT_IEEE(_R0,_w, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 98 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_w) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3E8FF67B),
},
{
/* 99 */
ALU_ADD(__,_x, _R1 _NEG,_x, _R2,_x),
ALU_MOV(_R0,_y, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_w, ALU_SRC_LITERAL,_z),
ALU_MOV(_R1,_y, ALU_SRC_LITERAL,_w)
ALU_LAST,
ALU_LITERAL4(0x3E4CCCCD, 0x38BF8800, 0xBD2CC161, 0x387F6000),
/* 100 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x) CLAMP,
ALU_ADD(__,_y, ALU_SRC_PV _NEG,_y, ALU_SRC_PS,_x),
ALU_MOV(_R1,_z, ALU_SRC_LITERAL,_y),
ALU_MULADD(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, _R1,_x)
ALU_LAST,
ALU_LITERAL3(0x4085E40A, 0x3ECCCCCD, 0x3CA83EF0),
/* 101 */
ALU_MULADD(_R123,_x, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_MULADD(_R127,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, _R0,_y),
ALU_ADD(__,_w, _R0 _NEG,_z, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL3(0x40400000, 0xC0000000, 0x3CA83EF0),
/* 102 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, _R0,_z),
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
ALU_LITERAL(0x3CA83EF0),
/* 103 */
ALU_MULADD(_R4,_x, ALU_SRC_PV,_x, ALU_SRC_PV,_w, _R4,_x),
ALU_MULADD(_R4,_y, _R127,_z, ALU_SRC_PV,_w, _R4,_y),
ALU_MULADD(_R4,_z, _R127,_w, ALU_SRC_PV,_w, _R4,_z)
ALU_LAST,
},
{
/* 104 */
ALU_MOV(_R0,_z, ALU_SRC_0,_x),
ALU_MOV(_R0,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3F000000),
/* 105 */
ALU_DOT4(__,_x, _R0,_x, _R0,_x),
ALU_DOT4(__,_y, _R2,_y, _R2,_y),
ALU_DOT4(__,_z, ALU_SRC_PV,_z, ALU_SRC_PV,_z),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x80000000),
/* 106 */
ALU_SQRT_IEEE_D2(__,_x, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 107 */
ALU_ADD(__,_w, ALU_SRC_PS _NEG,_x, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3FC00000),
/* 108 */
ALU_SQRT_IEEE(__,_x, ALU_SRC_PV,_w) SCL_210
ALU_LAST,
/* 109 */
ALU_MUL(__,_x, _R4,_z, ALU_SRC_PS,_x),
ALU_MUL(__,_y, _R4,_y, ALU_SRC_PS,_x),
ALU_MUL(_R0,_x, _R4,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 110 */
ALU_MOV(_R0,_y, ALU_SRC_PV,_y),
ALU_MOV(_R0,_z, ALU_SRC_PV,_x)
ALU_LAST,
},
};
static GX2AttribVar attributes[] =
{
{ "Position", GX2_SHADER_VAR_TYPE_FLOAT4, 0, 0},
{ "TexCoord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, 1},
};
static GX2AttribStream attribute_stream[] =
{
{0, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _1), GX2_ENDIAN_SWAP_DEFAULT},
{1, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _0), GX2_ENDIAN_SWAP_DEFAULT},
};
static GX2SamplerVar samplers[] =
{
{ "Source", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, 0 },
};
static GX2UniformBlock uniform_blocks[] = {
{"UBO", 1, 96}
};
static GX2UniformVar uniform_vars[] = {
{"global.MVP", GX2_SHADER_VAR_TYPE_FLOAT, 1, 0, 0},
{"global.OutputSize", GX2_SHADER_VAR_TYPE_FLOAT, 1, 16, 0},
{"global.time", GX2_SHADER_VAR_TYPE_FLOAT, 1, 20, 0},
};
GX2Shader bokeh_shader =
{
{
{
.sq_pgm_resources_vs.num_gprs = 2,
.sq_pgm_resources_vs.stack_size = 1,
.spi_vs_out_config.vs_export_count = 0,
.num_spi_vs_out_id = 1,
{
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
},
.sq_vtx_semantic_clear = ~0x1,
.num_sq_vtx_semantic = 1,
{
0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
.vgt_vertex_reuse_block_cntl.vtx_reuse_depth = 0xE,
.vgt_hos_reuse_depth.reuse_depth = 0x10,
}, /* regs */
.size = sizeof(vs_program),
.program = (uint8_t*)&vs_program,
.mode = GX2_SHADER_MODE_UNIFORM_BLOCK,
.uniformBlockCount = countof(uniform_blocks), uniform_blocks,
.uniformVarCount = countof(uniform_vars), uniform_vars,
.attribVarCount = countof(attributes), attributes,
},
{
{
.sq_pgm_resources_ps.num_gprs = 5,
.sq_pgm_resources_ps.stack_size = 1,
.sq_pgm_exports_ps.export_mode = 0x2,
.spi_ps_in_control_0.num_interp = 1,
.spi_ps_in_control_0.position_ena = TRUE,
.spi_ps_in_control_0.persp_gradient_ena = FALSE,
.spi_ps_in_control_0.baryc_sample_cntl = spi_baryc_cntl_centers_only,
.num_spi_ps_input_cntl = 1, {{.semantic = 0, .default_val = 1}},
.cb_shader_mask.output0_enable = 0xF,
.cb_shader_control.rt0_enable = TRUE,
.db_shader_control.z_order = db_z_order_early_z_then_late_z,
}, /* regs */
.size = sizeof(ps_program),
.program = (uint8_t*)&ps_program,
.mode = GX2_SHADER_MODE_UNIFORM_BLOCK,
.uniformBlockCount = countof(uniform_blocks), uniform_blocks,
.uniformVarCount = countof(uniform_vars), uniform_vars,
.samplerVarCount = countof(samplers), samplers,
},
.attribute_stream = attribute_stream,
};

View File

@ -0,0 +1,38 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) out vec4 FragColor;
void main(void)
{
float speed = global.time * 4.0;
vec2 uv = -1.0 + 2.0 * gl_FragCoord.xy / global.OutputSize;
uv.x *= global.OutputSize.x / global.OutputSize.y;
vec3 color = vec3(0.0);
for( int i=0; i < 6; i++ )
{
float pha = sin(float(i) * 546.13 + 1.0) * 0.5 + 0.5;
float siz = pow(sin(float(i) * 651.74 + 5.0) * 0.5 + 0.5, 4.0);
float pox = sin(float(i) * 321.55 + 4.1) * global.OutputSize.x / global.OutputSize.y;
float rad = 0.1 + 0.5 * siz + sin(pha + siz) / 4.0;
vec2 pos = vec2(pox + sin(speed / 15. + pha + siz), - 1.0 - rad + (2.0 + 2.0 * rad) * fract(pha + 0.3 * (speed / 7.) * (0.2 + 0.8 * siz)));
float dis = length(uv - pos);
if(dis < rad)
{
vec3 col = mix(vec3(0.194 * sin(speed / 6.0) + 0.3, 0.2, 0.3 * pha), vec3(1.1 * sin(speed / 9.0) + 0.3, 0.2 * pha, 0.4), 0.5 + 0.5 * sin(float(i)));
color += col.zyx * (1.0 - smoothstep(rad * 0.15, rad, dis));
}
}
color *= sqrt(1.5 - 0.5 * length(uv));
FragColor = vec4(color.r, color.g, color.b , 0.5);
}

View File

@ -0,0 +1,18 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
}

View File

@ -17,8 +17,8 @@
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "frame_shader.h"
#include "gx2_shader_inl.h"
#include "frame.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct

View File

@ -21,25 +21,22 @@
extern "C" {
#endif
typedef struct
{
struct
{
float x;
float y;
float z;
}pos;
}ribbon_vertex_t;
typedef struct
__attribute__((scalar_storage_order ("little-endian")))
__attribute__((aligned (16)))
{
GX2_mat4x4 mvp;
GX2_vec2 OutputSize;
float time;
}ribbon_uniform_t;
}menu_shader_uniform_t;
extern GX2Shader ribbon_shader;
extern GX2Shader ribbon_simple_shader;
extern GX2Shader snow_simple_shader;
extern GX2Shader snow_shader;
extern GX2Shader bokeh_shader;
extern GX2Shader snowflake_shader;
#ifdef __cplusplus
}

View File

@ -17,8 +17,8 @@
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "frame_shader.h"
#include "gx2_shader_inl.h"
#include "menu_shaders.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
@ -38,10 +38,10 @@ static struct
},
{
ALU_MOV(_R7,_x, _R1,_x),
ALU_MUL_IEEE(__,_y, KC0(0),_x, ALU_SRC_LITERAL,_x),
ALU_MUL_IEEE(__,_z, KC0(0),_x, ALU_SRC_LITERAL,_y),
ALU_MUL_IEEE(__,_w, KC0(0),_x, ALU_SRC_LITERAL,_z),
ALU_MUL_IEEE(_R127,_w, KC0(0),_x, ALU_SRC_0_5,_x)
ALU_MUL_IEEE(__,_y, KC0(5),_x, ALU_SRC_LITERAL,_x),
ALU_MUL_IEEE(__,_z, KC0(5),_x, ALU_SRC_LITERAL,_y),
ALU_MUL_IEEE(__,_w, KC0(5),_x, ALU_SRC_LITERAL,_z),
ALU_MUL_IEEE(_R127,_w, KC0(5),_x, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL3(0x3E4CCCCD,0x3C23D70A,0x3DCCCCCD),
ALU_ADD(__,_x, ALU_SRC_PV _NEG,_z, ALU_SRC_0, _x),
@ -309,12 +309,12 @@ ps_program =
static GX2AttribVar attributes[] =
{
{ "VertexCoord", GX2_SHADER_VAR_TYPE_FLOAT3, 0, 0},
{ "VertexCoord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, 0},
};
static GX2AttribStream attribute_stream[] =
{
{0, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32,
{0, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _1), GX2_ENDIAN_SWAP_DEFAULT}
};

View File

@ -2,8 +2,10 @@
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} constants;
} global;
layout(location = 0) in vec3 vEC;
layout(location = 0) out vec4 FragColor;

View File

@ -1,12 +1,14 @@
#version 150
layout(location = 0) in vec3 VertexCoord;
layout(location = 0) out vec3 vEC;
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} constants;
} global;
layout(location = 0) in vec2 VertexCoord;
layout(location = 0) out vec3 vEC;
float iqhash(float n)
{
@ -27,7 +29,7 @@ float noise(vec3 x)
float xmb_noise2(vec3 x)
{
return cos(x.z * 4.0) * cos(x.z + constants.time / 10.0 + x.x);
return cos(x.z * 4.0) * cos(x.z + global.time / 10.0 + x.x);
}
void main()
@ -38,14 +40,14 @@ void main()
v.y = xmb_noise2(v2) / 8.0;
v3.x -= constants.time / 5.0;
v3.x -= global.time / 5.0;
v3.x /= 4.0;
v3.z -= constants.time / 10.0;
v3.y -= constants.time / 100.0;
v3.z -= global.time / 10.0;
v3.y -= global.time / 100.0;
v.z -= noise(v3 * 7.0) / 15.0;
v.y -= noise(v3 * 7.0) / 15.0 + cos(v.x * 2.0 - constants.time / 2.0) / 5.0 - 0.3;
v.y -= noise(v3 * 7.0) / 15.0 + cos(v.x * 2.0 - global.time / 2.0) / 5.0 - 0.3;
v.y = -v.y;
vEC = v;

View File

@ -0,0 +1,277 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2014-2018 - Ali Bouhlel
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "gx2_shader_inl.h"
#include "menu_shaders.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
{
u64 cf[32];
u64 alu[88];
} vs_program =
{
{
CALL_FS NO_BARRIER,
ALU(32,88) KCACHE0(CB1, _0_15),
EXP_DONE(POS0, _R1,_x,_y,_z,_w),
EXP_DONE(PARAM0, _R0,_m,_m,_m,_m)
END_OF_PROGRAM
},
{
/* 0 */
ALU_MUL_IEEE(__,_x, _R1,_y, ALU_SRC_LITERAL,_x),
ALU_MUL_IEEE(__,_z, KC0(5),_x, ALU_SRC_0_5,_x),
ALU_MUL(__,_w, _R1,_y, ALU_SRC_LITERAL,_y),
ALU_MOV(_R1,_z, _R1,_y)
ALU_LAST,
ALU_LITERAL2(0x3EAAAAAB, 0x40400000),
/* 1 */
ALU_ADD(__,_x, _R1,_x, ALU_SRC_PV,_z),
ALU_ADD(__,_y, _R1,_x, ALU_SRC_PV,_x),
ALU_FLOOR(__,_z, ALU_SRC_PV,_w),
ALU_FRACT(_R127,_w, ALU_SRC_PV,_w),
ALU_MOV(_R1,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3F800000),
/* 2 */
ALU_MUL(_R127,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_FLOOR(__,_y, ALU_SRC_PV,_x),
ALU_FRACT(__,_z, ALU_SRC_PV,_x),
ALU_ADD_x2(__,_w, KC0(5),_x, ALU_SRC_PV,_y),
ALU_MOV_x2(__,_x, ALU_SRC_PV,_w)
ALU_LAST,
ALU_LITERAL(0x42E20000),
/* 3 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_MOV_x2(__,_y, ALU_SRC_PV,_z),
ALU_ADD(__,_z, ALU_SRC_PV,_y, ALU_SRC_0,_x),
ALU_MUL(_R126,_w, ALU_SRC_PV,_z, ALU_SRC_PV,_z),
ALU_ADD(_R125,_w, ALU_SRC_PS _NEG,_x, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL2(0x3E22F983, 0x40400000),
/* 4 */
ALU_ADD(__,_x, _R127,_x, ALU_SRC_PV,_z),
ALU_ADD(__,_y, ALU_SRC_PV _NEG,_y, ALU_SRC_LITERAL,_x),
ALU_FRACT(_R127,_z, ALU_SRC_PV,_x),
ALU_MUL(_R127,_w, _R127,_w, _R127,_w)
ALU_LAST,
ALU_LITERAL(0x40400000),
/* 5 */
ALU_ADD(__,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_ADD(__,_y, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_z, ALU_SRC_PV,_x, ALU_SRC_1,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, ALU_SRC_0_5,_x),
ALU_MUL(_R126,_x, ALU_SRC_PV,_y, _R126,_w)
ALU_LAST,
ALU_LITERAL3(0x42E40000, 0x42E20000, 0x3E22F983),
/* 6 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_FRACT(__,_y, ALU_SRC_PV,_w),
ALU_MULADD(_R123,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_MULADD(_R127,_x, _R127,_z, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3E22F983, 0xC0490FDB, 0x40C90FDB),
/* 7 */
ALU_FRACT(__,_x, ALU_SRC_PV,_z),
ALU_FRACT(__,_y, ALU_SRC_PV,_x),
ALU_FRACT(__,_z, ALU_SRC_PV,_w),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MUL(_R126,_w, _R125,_w, _R127,_w)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 8 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_z),
ALU_MULADD(_R123,_z, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MUL(_R127,_w, _R127,_x, ALU_SRC_LITERAL,_z)
ALU_LAST,
ALU_LITERAL3(0xC0490FDB, 0x40C90FDB, 0x3E22F983),
/* 9 */
ALU_MUL(_R127,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_MUL(__,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x),
ALU_MUL(_R127,_z, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_SIN(__,_x, ALU_SRC_PV,_y) SCL_210
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 10 */
ALU_MUL(__,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_SIN(__,_y, ALU_SRC_PV,_y) SCL_210
ALU_LAST,
ALU_LITERAL(0x472AEE8C),
/* 11 */
ALU_MUL(__,_x, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_FRACT(_R126,_z, ALU_SRC_PV,_y),
ALU_SIN(__,_x, _R127,_x) SCL_210
ALU_LAST,
ALU_LITERAL(0x472AEE8C),
/* 12 */
ALU_MUL(__,_x, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_FRACT(_R125,_w, ALU_SRC_PV,_x),
ALU_SIN(__,_x, _R127,_z) SCL_210
ALU_LAST,
ALU_LITERAL(0x472AEE8C),
/* 13 */
ALU_MUL(__,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_FRACT(__,_w, ALU_SRC_PV,_x),
ALU_COS(__,_y, _R127,_w) SCL_210
ALU_LAST,
ALU_LITERAL(0x472AEE8C),
/* 14 */
ALU_MUL_IEEE(_R127,_x, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_ADD(__,_y, _R125 _NEG,_w, ALU_SRC_PV,_w),
ALU_FRACT(__,_z, ALU_SRC_PV,_y)
ALU_LAST,
ALU_LITERAL(0x3DCCCCCD),
/* 15 */
ALU_ADD(__,_x, _R126 _NEG,_z, ALU_SRC_PV,_z),
ALU_MULADD(_R127,_z, ALU_SRC_PV,_y, _R126,_x, _R125,_w)
ALU_LAST,
/* 16 */
ALU_MULADD(_R125,_w, ALU_SRC_PV,_x, _R126,_x, _R126,_z)
ALU_LAST,
/* 17 */
ALU_ADD(__,_x, ALU_SRC_PV _NEG,_w, _R127,_z)
ALU_LAST,
/* 18 */
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, _R126,_w, _R125,_w)
ALU_LAST,
/* 19 */
ALU_MUL_IEEE(__,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E800000),
/* 20 */
ALU_ADD(__,_x, ALU_SRC_PV,_y, _R127,_x)
ALU_LAST,
/* 21 */
ALU_MOV(_R1,_y, ALU_SRC_PV _NEG,_x)
ALU_LAST,
},
};
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
{
u64 cf[32];
u64 alu[3];
} ps_program =
{
{
ALU(32,3),
EXP_DONE(PIX0, _R0,_x,_x,_x,_w)
END_OF_PROGRAM
},
{
/* 0 */
ALU_MOV(_R0,_x, ALU_SRC_LITERAL,_x),
ALU_MOV(_R0,_w, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL2(0x3D4CCCCD, 0x3F800000),
},
};
static GX2AttribVar attributes[] =
{
{ "Position", GX2_SHADER_VAR_TYPE_FLOAT4, 0, 0},
{ "TexCoord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, 1},
};
static GX2AttribStream attribute_stream[] =
{
{0, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _1), GX2_ENDIAN_SWAP_DEFAULT},
{1, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _0), GX2_ENDIAN_SWAP_DEFAULT},
};
static GX2SamplerVar samplers[] =
{
{ "Source", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, 0 },
};
static GX2UniformBlock uniform_blocks[] = {
{"UBO", 1, 96}
};
static GX2UniformVar uniform_vars[] = {
{"global.MVP", GX2_SHADER_VAR_TYPE_FLOAT, 1, 0, 0},
{"global.OutputSize", GX2_SHADER_VAR_TYPE_FLOAT, 1, 16, 0},
{"global.time", GX2_SHADER_VAR_TYPE_FLOAT, 1, 20, 0},
};
GX2Shader ribbon_simple_shader =
{
{
{
.sq_pgm_resources_vs.num_gprs = 2,
.sq_pgm_resources_vs.stack_size = 1,
.spi_vs_out_config.vs_export_count = 0,
.num_spi_vs_out_id = 1,
{
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
},
.sq_vtx_semantic_clear = ~0x1,
.num_sq_vtx_semantic = 1,
{
0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
.vgt_vertex_reuse_block_cntl.vtx_reuse_depth = 0xE,
.vgt_hos_reuse_depth.reuse_depth = 0x10,
}, /* regs */
.size = sizeof(vs_program),
.program = (uint8_t*)&vs_program,
.mode = GX2_SHADER_MODE_UNIFORM_BLOCK,
.uniformBlockCount = countof(uniform_blocks), uniform_blocks,
.uniformVarCount = countof(uniform_vars), uniform_vars,
.attribVarCount = countof(attributes), attributes,
},
{
{
.sq_pgm_resources_ps.num_gprs = 1,
.sq_pgm_resources_ps.stack_size = 0,
.sq_pgm_exports_ps.export_mode = 0x2,
.spi_ps_in_control_0.num_interp = 0,
.spi_ps_in_control_0.position_ena = FALSE,
.spi_ps_in_control_0.persp_gradient_ena = FALSE,
.spi_ps_in_control_0.baryc_sample_cntl = spi_baryc_cntl_centers_only,
.num_spi_ps_input_cntl = 0,
.cb_shader_mask.output0_enable = 0xF,
.cb_shader_control.rt0_enable = TRUE,
.db_shader_control.z_order = db_z_order_early_z_then_late_z,
}, /* regs */
.size = sizeof(ps_program),
.program = (uint8_t*)&ps_program,
.mode = GX2_SHADER_MODE_UNIFORM_BLOCK,
.samplerVarCount = countof(samplers), samplers,
},
.attribute_stream = attribute_stream,
};

View File

@ -0,0 +1,14 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = vec4(0.05, 0.05, 0.05, 1.0);
}

View File

@ -0,0 +1,38 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) in vec2 VertexCoord;
float iqhash(float n)
{
return fract(sin(n) * 43758.5453);
}
float noise(vec3 x)
{
vec3 p = floor(x);
vec3 f = fract(x);
f = f * f * (3.0 - 2.0 * f);
float n = p.x + p.y * 57.0 + 113.0 * p.z;
return mix(mix(mix(iqhash(n), iqhash(n + 1.0), f.x),
mix(iqhash(n + 57.0), iqhash(n + 58.0), f.x), f.y),
mix(mix(iqhash(n + 113.0), iqhash(n + 114.0), f.x),
mix(iqhash(n + 170.0), iqhash(n + 171.0), f.x), f.y), f.z);
}
void main()
{
vec3 v = vec3(VertexCoord.x, 0.0, VertexCoord.y);
vec3 v2 = v;
v2.x = v2.x + global.time / 2.0;
v2.z = v.z * 3.0;
v.y = cos((v.x + v.z / 3.0 + global.time) * 2.0) / 10.0 + noise(v2.xyz) / 4.0;
v.y = -v.y;
gl_Position = vec4(v, 1.0);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) out vec4 FragColor;
const float baseScale = 3.5; // [1.0 .. 10.0]
const float density = 0.7; // [0.01 .. 1.0]
const float speed = 0.25; // [0.1 .. 1.0]
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
float dist_func(vec2 distv)
{
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
dist = clamp(dist, 0.0, 1.0);
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
}
float random_dots(vec2 co)
{
float part = 1.0 / 20.0;
vec2 cd = floor(co / part);
float p = rand(cd);
if (p > 0.005 * (density * 40.0))
return 0.0;
vec2 dpos = (vec2(fract(p * 2.0) , p) + vec2(2.0, 2.0)) * 0.25;
vec2 cellpos = fract(co / part);
vec2 distv = (cellpos - dpos);
return dist_func(distv);
}
float snow(vec2 pos, float time, float scale)
{
// add wobble
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
// add gravity
pos += time * scale * vec2(-0.5, 1.0) * 4.0;
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
}
void main(void)
{
float tim = global.time * 0.4 * speed;
vec2 pos = gl_FragCoord.xy / global.OutputSize.xx;
pos.y = 1.0 - pos.y; // Flip Y
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y * 4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -0,0 +1,18 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) out vec4 FragColor;
const float baseScale = 1.25; // [1.0 .. 10.0]
const float density = 0.5; // [0.01 .. 1.0]
const float speed = 0.15; // [0.1 .. 1.0]
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
float dist_func(vec2 distv)
{
float dist = sqrt((distv.x * distv.x) + (distv.y * distv.y)) * (40.0 / baseScale);
dist = clamp(dist, 0.0, 1.0);
return cos(dist * (3.14159265358 * 0.5)) * 0.5;
}
float random_dots(vec2 co)
{
float part = 1.0 / 20.0;
vec2 cd = floor(co / part);
float p = rand(cd);
if (p > 0.005 * (density * 40.0))
return 0.0;
vec2 dpos = (vec2(fract(p * 2.0) , p) + vec2(2.0, 2.0)) * 0.25;
vec2 cellpos = fract(co / part);
vec2 distv = (cellpos - dpos);
return dist_func(distv);
}
float snow(vec2 pos, float time, float scale)
{
// add wobble
pos.x += cos(pos.y * 1.2 + time * 3.14159 * 2.0 + 1.0 / scale) / (8.0 / scale) * 4.0;
// add gravity
pos += time * scale * vec2(-0.5, 1.0) * 4.0;
return random_dots(pos / scale) * (scale * 0.5 + 0.5);
}
void main(void)
{
float tim = global.time * 0.4 * speed;
vec2 pos = gl_FragCoord.xy / global.OutputSize.xx;
pos.y = 1.0 - pos.y; // Flip Y
float a = 0.0;
// Each of these is a layer of snow
// Remove some for better performance
// Changing the scale (3rd value) will mess with the looping
a += snow(pos, tim, 1.0);
a += snow(pos, tim, 0.7);
a += snow(pos, tim, 0.6);
a += snow(pos, tim, 0.5);
a += snow(pos, tim, 0.4);
a += snow(pos, tim, 0.3);
a += snow(pos, tim, 0.25);
a += snow(pos, tim, 0.125);
a = a * min(pos.y * 4.0, 1.0);
FragColor = vec4(1.0, 1.0, 1.0, a);
}

View File

@ -0,0 +1,18 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
}

View File

@ -0,0 +1,645 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2014-2018 - Ali Bouhlel
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "gx2_shader_inl.h"
#include "menu_shaders.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
{
u64 cf[32];
u64 alu[16];
} vs_program =
{
{
CALL_FS NO_BARRIER,
ALU(32,16) KCACHE0(CB1, _0_15),
EXP_DONE(POS0, _R1,_x,_y,_z,_w),
EXP_DONE(PARAM0, _R0,_m,_m,_m,_m)
END_OF_PROGRAM
},
{
/* 0 */
ALU_MUL(__,_x, _R1,_w, KC0(3),_w),
ALU_MUL(__,_y, _R1,_w, KC0(3),_z),
ALU_MUL(__,_z, _R1,_w, KC0(3),_y),
ALU_MUL(__,_w, _R1,_w, KC0(3),_x)
ALU_LAST,
/* 1 */
ALU_MULADD(_R123,_x, _R1,_z, KC0(2),_w, ALU_SRC_PV,_x),
ALU_MULADD(_R123,_y, _R1,_z, KC0(2),_z, ALU_SRC_PV,_y),
ALU_MULADD(_R123,_z, _R1,_z, KC0(2),_y, ALU_SRC_PV,_z),
ALU_MULADD(_R123,_w, _R1,_z, KC0(2),_x, ALU_SRC_PV,_w)
ALU_LAST,
/* 2 */
ALU_MULADD(_R123,_x, _R1,_y, KC0(1),_w, ALU_SRC_PV,_x),
ALU_MULADD(_R123,_y, _R1,_y, KC0(1),_z, ALU_SRC_PV,_y),
ALU_MULADD(_R123,_z, _R1,_y, KC0(1),_y, ALU_SRC_PV,_z),
ALU_MULADD(_R123,_w, _R1,_y, KC0(1),_x, ALU_SRC_PV,_w)
ALU_LAST,
/* 3 */
ALU_MULADD(_R1,_x, _R1,_x, KC0(0),_x, ALU_SRC_PV,_w),
ALU_MULADD(_R1,_y, _R1,_x, KC0(0),_y, ALU_SRC_PV,_z),
ALU_MULADD(_R1,_z, _R1,_x, KC0(0),_z, ALU_SRC_PV,_y),
ALU_MULADD(_R1,_w, _R1,_x, KC0(0),_w, ALU_SRC_PV,_x)
ALU_LAST,
},
};
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct
{
u64 cf[32];
u64 alu[120];
u64 alu1[19];
u64 alu2[1];
u64 alu3[106];
u64 alu4[19];
u64 alu5[2];
} ps_program =
{
{
ALU_PUSH_BEFORE(32,120) KCACHE0(CB1, _0_15),
JUMP(0,3) VALID_PIX,
ALU(152,19),
ELSE(1, 5) VALID_PIX,
ALU_POP_AFTER(171,1),
ALU_PUSH_BEFORE(172,106) KCACHE0(CB1, _0_15),
JUMP(1, 8) VALID_PIX,
ALU_POP_AFTER(278,19),
ALU(297,2),
EXP_DONE(PIX0, _R0,_x,_x,_x,_x)
END_OF_PROGRAM
},
{
/* 0 */
ALU_MOV(_R127,_x, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R124,_y, KC0(5),_x, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y),
ALU_MUL(__,_z, KC0(5),_x, ALU_SRC_LITERAL,_y),
ALU_ADD(_R127,_w, KC0(5),_x, ALU_SRC_1,_x),
ALU_RECIP_IEEE(__,_x, KC0(4),_x) SCL_210
ALU_LAST,
ALU_LITERAL3(0x3F800000, 0x414E4000, 0x3F52C000),
/* 1 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_MUL_IEEE_x2(_R126,_y, _R0,_x, ALU_SRC_PS,_x),
ALU_ADD(__,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y),
ALU_MUL_IEEE(__,_w, ALU_SRC_PV,_y, ALU_SRC_0_5,_x),
ALU_RECIP_IEEE(__,_x, KC0(4),_y) SCL_210
ALU_LAST,
ALU_LITERAL2(0x3A83126F, 0xC0000000),
/* 2 */
ALU_FLOOR(__,_x, ALU_SRC_PV,_w),
ALU_MUL_IEEE(_R127,_y, ALU_SRC_PV,_z, ALU_SRC_0_5,_x),
ALU_MUL_IEEE_x2(_R127,_z, _R0,_y, ALU_SRC_PS,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_RECIP_IEEE(_R125,_y, KC0(4),_y) SCL_210
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 3 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_DOT4(__,_y, _R127,_x, ALU_SRC_LITERAL,_y),
ALU_DOT4(__,_z, _R127,_x, ALU_SRC_0,_x),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_z, ALU_SRC_0,_x),
ALU_FRACT(__,_x, ALU_SRC_PV,_w)
ALU_LAST,
ALU_LITERAL3(0x414FD639, 0x429C774C, 0x80000000),
/* 4 */
ALU_ADD(_R0,_x, _R126,_y, ALU_SRC_1 _NEG,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_z, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, ALU_SRC_0_5,_x),
ALU_ADD(__,_w, _R127,_y, ALU_SRC_1,_x) VEC_201,
ALU_MUL_IEEE(_R127,_x, KC0(4),_x, _R125,_y)
ALU_LAST,
ALU_LITERAL3(0xC0490FDB, 0x40C90FDB, 0x3E22F983),
/* 5 */
ALU_MUL(__,_x, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x),
ALU_FRACT(__,_y, ALU_SRC_PV,_z),
ALU_FLOOR(__,_z, ALU_SRC_PV,_w),
ALU_MOV(_R1,_w, ALU_SRC_0,_x),
ALU_ADD(_R0,_y, _R127,_z, ALU_SRC_1 _NEG,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 6 */
ALU_MUL(_R0,_x, _R0,_x, _R127,_x),
ALU_MULADD(_R123,_z, ALU_SRC_PV _NEG,_z, ALU_SRC_LITERAL,_x, _R124,_y),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y),
ALU_SIN(__,_x, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
ALU_LITERAL3(0x40000000, 0xC0490FDB, 0x40C90FDB),
/* 7 */
ALU_MUL(__,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x),
ALU_MUL_IEEE(_R127,_z, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, ALU_SRC_PV _NEG,_z, ALU_SRC_1,_x),
ALU_MUL_IEEE(_R0,_z, _R127,_w, ALU_SRC_LITERAL,_z)
ALU_LAST,
ALU_LITERAL3(0x3E22F983, 0x3DCCCCCD, 0x3E800000),
/* 8 */
ALU_ADD(__,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_ADD(_R126,_z, _R0 _NEG,_y, ALU_SRC_PV,_w),
ALU_MOV(_R2,_w, ALU_SRC_1,_x),
ALU_SIN(__,_y, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
ALU_LITERAL(0x414E4000),
/* 9 */
ALU_SETGT(__,_x, ALU_SRC_0,_x, ALU_SRC_PV,_z),
ALU_MUL(__,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y, ALU_SRC_0_5,_x),
ALU_SETGT(__,_w, ALU_SRC_PV,_z, ALU_SRC_0,_x),
ALU_SETE_DX10(_R124,_y, ALU_SRC_PV,_z, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL2(0x472AEE8C, 0x3E22F983),
/* 10 */
ALU_FRACT(__,_x, ALU_SRC_PV,_z),
ALU_ADD(_R125,_z, ALU_SRC_PV,_w, ALU_SRC_PV _NEG,_x),
ALU_FRACT(__,_w, ALU_SRC_PV,_y)
ALU_LAST,
/* 11 */
ALU_ADD(__,_x, _R127,_z, ALU_SRC_PV,_w),
ALU_MUL(_R127,_y, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_z, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3FC90FDB, 0xC0490FDB, 0x40C90FDB),
/* 12 */
ALU_MUL(__,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PV _NEG,_x, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3E22F983, 0x3FE66666, 0x40666666),
/* 13 */
ALU_ADD(__,_x, _R0 _NEG,_x, ALU_SRC_PV,_y),
ALU_SIN(_R126,_w, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 14 */
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_SETE_DX10(_R124,_z, ALU_SRC_PV,_x, ALU_SRC_0,_x),
ALU_SETGT_DX10(__,_w, ALU_SRC_0,_x, ALU_SRC_PV,_x),
ALU_RECIP_IEEE(__,_y, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 15 */
ALU_MUL(_R126,_x, _R124,_y, ALU_SRC_PV,_w),
ALU_MUL_IEEE(__,_z, _R126,_z, ALU_SRC_PS,_x),
ALU_MULADD(_R2,_x, _R126,_z, _R126,_z, ALU_SRC_PV,_y)
ALU_LAST,
/* 16 */
ALU_SETGT(__,_y, ALU_SRC_PV,_z, ALU_SRC_0,_x),
ALU_MAX_DX10(_R126,_z, ALU_SRC_PV,_z, ALU_SRC_PV _NEG,_z),
ALU_SETGT(__,_w, ALU_SRC_0,_x, ALU_SRC_PV,_z)
ALU_LAST,
/* 17 */
ALU_ADD(__,_x, ALU_SRC_PV,_y, ALU_SRC_PV _NEG,_w),
ALU_SETGT_DX10(_R124,_y, ALU_SRC_PV,_z, ALU_SRC_1,_x),
ALU_RECIP_IEEE(__,_x, ALU_SRC_PV,_z) SCL_210
ALU_LAST,
/* 18 */
ALU_MUL(__,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_CNDE_INT(_R123,_y, ALU_SRC_PV,_y, _R126,_z, ALU_SRC_PS,_x),
ALU_CNDE_INT(_R127,_z, ALU_SRC_PV,_y, ALU_SRC_PV,_x, ALU_SRC_PV _NEG,_x)
ALU_LAST,
ALU_LITERAL(0x3FC90FDB),
/* 19 */
ALU_MIN(__,_x, ALU_SRC_PV,_y, ALU_SRC_1,_x),
ALU_CNDE_INT(_R127,_w, _R124,_y, ALU_SRC_0,_x, ALU_SRC_PV,_x)
ALU_LAST,
/* 20 */
ALU_MAX(_R126,_z, ALU_SRC_PV,_x, ALU_SRC_1 _NEG,_x)
ALU_LAST,
/* 21 */
ALU_MUL(_R124,_y, ALU_SRC_PV,_z, ALU_SRC_PV,_z)
ALU_LAST,
/* 22 */
ALU_MULADD(_R123,_z, ALU_SRC_LITERAL,_y, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_w, ALU_SRC_LITERAL,_z, ALU_SRC_PV,_y, ALU_SRC_1,_x)
ALU_LAST,
ALU_LITERAL3(0x3F43B24E, 0x3D6EE04D, 0x3EDCF805),
/* 23 */
ALU_MUL(_R127,_x, _R126 _ABS,_z, ALU_SRC_PV,_w),
ALU_MULADD(_R123,_y, _R124,_y, ALU_SRC_PV,_z, ALU_SRC_1,_x)
ALU_LAST,
/* 24 */
ALU_RECIP_IEEE(__,_x, ALU_SRC_PV,_y) SCL_210
ALU_LAST,
/* 25 */
ALU_MUL(__,_x, _R127,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 26 */
ALU_CNDGT(_R123,_z, _R126,_z, ALU_SRC_PV,_x, ALU_SRC_PV _NEG,_x)
ALU_LAST,
/* 27 */
ALU_MULADD(_R124,_y, _R127,_z, ALU_SRC_PV,_z, _R127,_w)
ALU_LAST,
/* 28 */
ALU_SETGT(__,_y, ALU_SRC_PV,_y, ALU_SRC_0,_x),
ALU_SETGT(__,_w, ALU_SRC_0,_x, ALU_SRC_PV,_y)
ALU_LAST,
/* 29 */
ALU_ADD(__,_x, ALU_SRC_PV,_y, ALU_SRC_PV _NEG,_w)
ALU_LAST,
/* 30 */
ALU_ADD(__,_y, _R125 _NEG,_z, ALU_SRC_PV,_x)
ALU_LAST,
/* 31 */
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_y, ALU_SRC_LITERAL,_x, _R124,_y)
ALU_LAST,
ALU_LITERAL(0x3FC90FDB),
/* 32 */
ALU_CNDE_INT(_R123,_x, _R126,_x, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x40490FDB),
/* 33 */
ALU_CNDE_INT(_R123,_z, _R124,_z, ALU_SRC_PV,_x, _R127,_y)
ALU_LAST,
/* 34 */
ALU_MULADD(_R0,_w, _R126,_w, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL(0x41200000),
/* 35 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R2,_x) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3AD3D70A),
},
{
/* 36 */
ALU_SETGT_DX10(_R127,_x, ALU_SRC_LITERAL,_x, _R2,_x),
ALU_MUL(__,_w, _R0,_w, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL2(0x3A53D70A, 0x41000000),
/* 37 */
ALU_MULADD(_R123,_z, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 38 */
ALU_FRACT(__,_y, ALU_SRC_PV,_z)
ALU_LAST,
/* 39 */
ALU_MULADD(_R123,_x, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 40 */
ALU_MUL(__,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 41 */
ALU_SIN(__,_x, ALU_SRC_PV,_w) SCL_210
ALU_LAST,
/* 42 */
ALU_SETGT_DX10(__,_y, ALU_SRC_0,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 43 */
ALU_CNDE_INT(_R126,_x, ALU_SRC_PV,_y, ALU_SRC_0,_x, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3F800000),
/* 44 */
ALU_ADD(__,_z, ALU_SRC_PV,_x, ALU_SRC_1,_x)
ALU_LAST,
/* 45 */
ALU_CNDE_INT(_R123,_y, _R127,_x, _R126,_x, ALU_SRC_PV,_z)
ALU_LAST,
/* 46 */
ALU_MUL(_R1,_x, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_y)
ALU_LAST,
ALU_LITERAL(0x3F258000),
/* 47 */
ALU_MOV(_R0,_w, _R2,_w)
ALU_LAST,
},
{
/* 48 */
ALU_MOV(_R0,_w, _R1,_w)
ALU_LAST,
},
{
/* 49 */
ALU_CNDE_INT(_R1,_z, _R0,_w, ALU_SRC_0,_x, _R1,_x)
ALU_LAST,
/* 50 */
ALU_MOV(_R127,_x, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R126,_y, KC0(5),_x, ALU_SRC_LITERAL,_z, ALU_SRC_LITERAL,_y),
ALU_MUL(__,_z, KC0(5),_x, ALU_SRC_LITERAL,_y),
ALU_ADD(__,_w, _R0,_z, ALU_SRC_LITERAL,_y),
ALU_ADD(_R1,_y, ALU_SRC_0,_x, _R1,_z)
ALU_LAST,
ALU_LITERAL3(0x3F800000, 0x411F6000, 0x3F1AA000),
/* 51 */
ALU_MUL_IEEE(__,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_y, ALU_SRC_0_5,_x),
ALU_MUL_IEEE(__,_z, ALU_SRC_PV,_y, ALU_SRC_0_5,_x),
ALU_ADD(__,_w, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_z)
ALU_LAST,
ALU_LITERAL3(0x3A83126F, 0x3E22F983, 0xC0000000),
/* 52 */
ALU_FLOOR(__,_x, ALU_SRC_PV,_z),
ALU_MUL_IEEE(_R127,_y, ALU_SRC_PV,_w, ALU_SRC_0_5,_x),
ALU_MULADD(_R123,_z, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x),
ALU_FRACT(_R127,_w, ALU_SRC_PV,_y)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 53 */
ALU_DOT4(__,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_DOT4(__,_y, _R127,_x, ALU_SRC_LITERAL,_y),
ALU_DOT4(__,_z, _R127,_x, ALU_SRC_0,_x),
ALU_DOT4(__,_w, ALU_SRC_LITERAL,_z, ALU_SRC_0,_x),
ALU_FRACT(__,_x, ALU_SRC_PV,_z)
ALU_LAST,
ALU_LITERAL3(0x414FD639, 0x429C774C, 0x80000000),
/* 54 */
ALU_MULADD(_R123,_x, _R127,_w, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_ADD(__,_z, _R127,_y, ALU_SRC_1,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_z, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL3(0xC0490FDB, 0x40C90FDB, 0x3E22F983),
/* 55 */
ALU_MUL(__,_x, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_x),
ALU_FRACT(__,_y, ALU_SRC_PV,_w),
ALU_FLOOR(__,_z, ALU_SRC_PV,_z),
ALU_MUL(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 56 */
ALU_MULADD(_R123,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x),
ALU_MULADD(_R123,_w, ALU_SRC_PV _NEG,_z, ALU_SRC_LITERAL,_z, _R126,_y),
ALU_SIN(__,_z, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
ALU_LITERAL3(0xC0490FDB, 0x40C90FDB, 0x40000000),
/* 57 */
ALU_MUL(__,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x),
ALU_ADD(__,_z, ALU_SRC_PV _NEG,_w, ALU_SRC_1,_x),
ALU_MUL_IEEE(_R127,_w, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_y),
ALU_SIN(_R126,_z, _R127,_w) SCL_210
ALU_LAST,
ALU_LITERAL2(0x3E22F983, 0x3DCCCCCD),
/* 58 */
ALU_ADD(_R125,_w, _R0 _NEG,_y, ALU_SRC_PV,_z),
ALU_SIN(__,_w, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 59 */
ALU_SETGT(__,_x, ALU_SRC_0,_x, ALU_SRC_PV,_w),
ALU_MUL(__,_y, ALU_SRC_PS,_x, ALU_SRC_LITERAL,_x),
ALU_SETGT(__,_z, ALU_SRC_PV,_w, ALU_SRC_0,_x),
ALU_SETE_DX10(_R126,_w, ALU_SRC_PV,_w, ALU_SRC_0,_x)
ALU_LAST,
ALU_LITERAL(0x472AEE8C),
/* 60 */
ALU_FRACT(__,_z, ALU_SRC_PV,_y),
ALU_ADD(_R124,_w, ALU_SRC_PV,_z, ALU_SRC_PV _NEG,_x)
ALU_LAST,
/* 61 */
ALU_ADD(__,_x, _R127,_w, ALU_SRC_PV,_z),
ALU_MUL(_R0,_w, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3FC90FDB),
/* 62 */
ALU_MULADD(_R123,_y, ALU_SRC_PV _NEG,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0x3FE66666, 0x40666666),
/* 63 */
ALU_ADD(__,_x, _R0 _NEG,_x, ALU_SRC_PV,_y)
ALU_LAST,
/* 64 */
ALU_MUL(__,_y, ALU_SRC_PV,_x, ALU_SRC_PV,_x),
ALU_SETGT_DX10(__,_z, ALU_SRC_0,_x, ALU_SRC_PV,_x),
ALU_SETE_DX10(_R127,_w, ALU_SRC_PV,_x, ALU_SRC_0,_x),
ALU_RECIP_IEEE(__,_y, ALU_SRC_PV,_x) SCL_210
ALU_LAST,
/* 65 */
ALU_MUL(_R126,_x, _R126,_w, ALU_SRC_PV,_z),
ALU_MUL_IEEE(__,_w, _R125,_w, ALU_SRC_PS,_x) VEC_120,
ALU_MULADD(_R0,_x, _R125,_w, _R125,_w, ALU_SRC_PV,_y)
ALU_LAST,
/* 66 */
ALU_SETGT(__,_y, ALU_SRC_PV,_w, ALU_SRC_0,_x),
ALU_SETGT(__,_z, ALU_SRC_0,_x, ALU_SRC_PV,_w),
ALU_MAX_DX10(_R126,_w, ALU_SRC_PV,_w, ALU_SRC_PV _NEG,_w)
ALU_LAST,
/* 67 */
ALU_ADD(__,_x, ALU_SRC_PV,_y, ALU_SRC_PV _NEG,_z),
ALU_SETGT_DX10(_R126,_y, ALU_SRC_PV,_w, ALU_SRC_1,_x),
ALU_RECIP_IEEE(__,_x, ALU_SRC_PV,_w) SCL_210
ALU_LAST,
/* 68 */
ALU_MUL(__,_x, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_x),
ALU_CNDE_INT(_R123,_y, ALU_SRC_PV,_y, _R126,_w, ALU_SRC_PS,_x),
ALU_CNDE_INT(_R125,_w, ALU_SRC_PV,_y, ALU_SRC_PV,_x, ALU_SRC_PV _NEG,_x)
ALU_LAST,
ALU_LITERAL(0x3FC90FDB),
/* 69 */
ALU_MIN(__,_x, ALU_SRC_PV,_y, ALU_SRC_1,_x),
ALU_CNDE_INT(_R127,_z, _R126,_y, ALU_SRC_0,_x, ALU_SRC_PV,_x)
ALU_LAST,
/* 70 */
ALU_MAX(_R126,_w, ALU_SRC_PV,_x, ALU_SRC_1 _NEG,_x)
ALU_LAST,
/* 71 */
ALU_MUL(_R126,_y, ALU_SRC_PV,_w, ALU_SRC_PV,_w)
ALU_LAST,
/* 72 */
ALU_MULADD(_R123,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_y, ALU_SRC_1,_x),
ALU_MULADD(_R123,_w, ALU_SRC_LITERAL,_z, ALU_SRC_PV,_y, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL3(0x3EDCF805, 0x3F43B24E, 0x3D6EE04D),
/* 73 */
ALU_MUL(_R127,_x, _R126 _ABS,_w, ALU_SRC_PV,_z),
ALU_MULADD(_R123,_y, _R126,_y, ALU_SRC_PV,_w, ALU_SRC_1,_x)
ALU_LAST,
/* 74 */
ALU_RECIP_IEEE(__,_x, ALU_SRC_PV,_y) SCL_210
ALU_LAST,
/* 75 */
ALU_MUL(__,_x, _R127,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 76 */
ALU_CNDGT(_R123,_w, _R126,_w, ALU_SRC_PV,_x, ALU_SRC_PV _NEG,_x)
ALU_LAST,
/* 77 */
ALU_MULADD(_R126,_y, _R125,_w, ALU_SRC_PV,_w, _R127,_z)
ALU_LAST,
/* 78 */
ALU_SETGT(__,_y, ALU_SRC_PV,_y, ALU_SRC_0,_x),
ALU_SETGT(__,_z, ALU_SRC_0,_x, ALU_SRC_PV,_y)
ALU_LAST,
/* 79 */
ALU_ADD(__,_x, ALU_SRC_PV,_y, ALU_SRC_PV _NEG,_z)
ALU_LAST,
/* 80 */
ALU_ADD(__,_y, _R124 _NEG,_w, ALU_SRC_PV,_x)
ALU_LAST,
/* 81 */
ALU_MULADD(_R123,_z, ALU_SRC_PV _NEG,_y, ALU_SRC_LITERAL,_x, _R126,_y)
ALU_LAST,
ALU_LITERAL(0x3FC90FDB),
/* 82 */
ALU_CNDE_INT(_R123,_x, _R126,_x, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x40490FDB),
/* 83 */
ALU_CNDE_INT(_R123,_w, _R127,_w, ALU_SRC_PV,_x, _R0,_w)
ALU_LAST,
/* 84 */
ALU_MULADD(_R0,_z, _R126,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_w)
ALU_LAST,
ALU_LITERAL(0x41200000),
/* 85 */
ALU_PRED_SETGT(__,_x, ALU_SRC_LITERAL,_x, _R0,_x) UPDATE_EXEC_MASK(DEACTIVATE) UPDATE_PRED
ALU_LAST,
ALU_LITERAL(0x3A0851EB),
},
{
/* 86 */
ALU_SETGT_DX10(_R127,_x, ALU_SRC_LITERAL,_x, _R0,_x),
ALU_MUL(__,_w, _R0,_z, ALU_SRC_LITERAL,_y)
ALU_LAST,
ALU_LITERAL2(0x398851EB, 0x41000000),
/* 87 */
ALU_MULADD(_R123,_y, ALU_SRC_PV,_w, ALU_SRC_LITERAL,_x, ALU_SRC_0_5,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 88 */
ALU_FRACT(__,_x, ALU_SRC_PV,_y)
ALU_LAST,
/* 89 */
ALU_MULADD(_R123,_z, ALU_SRC_PV,_x, ALU_SRC_LITERAL,_y, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL2(0xC0490FDB, 0x40C90FDB),
/* 90 */
ALU_MUL(__,_w, ALU_SRC_PV,_z, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3E22F983),
/* 91 */
ALU_SIN(__,_x, ALU_SRC_PV,_w) SCL_210
ALU_LAST,
/* 92 */
ALU_SETGT_DX10(__,_x, ALU_SRC_0,_x, ALU_SRC_PS,_x)
ALU_LAST,
/* 93 */
ALU_CNDE_INT(_R127,_z, ALU_SRC_PV,_x, ALU_SRC_0,_x, ALU_SRC_LITERAL,_x)
ALU_LAST,
ALU_LITERAL(0x3F800000),
/* 94 */
ALU_ADD(__,_y, ALU_SRC_PV,_z, ALU_SRC_1,_x)
ALU_LAST,
/* 95 */
ALU_CNDE_INT(_R123,_x, _R127,_x, _R127,_z, ALU_SRC_PV,_y)
ALU_LAST,
/* 96 */
ALU_MUL(_R1,_z, ALU_SRC_LITERAL,_x, ALU_SRC_PV,_x)
ALU_LAST,
ALU_LITERAL(0x3E550000),
/* 97 */
ALU_MOV(_R1,_w, _R2,_w)
ALU_LAST,
},
{
/* 98 */
ALU_CNDE_INT(_R0,_w, _R1,_w, ALU_SRC_0,_x, _R1,_z)
ALU_LAST,
/* 99 */
ALU_ADD(_R0,_x, _R1,_y, _R0,_w)
ALU_LAST,
},
};
static GX2AttribVar attributes[] =
{
{ "Position", GX2_SHADER_VAR_TYPE_FLOAT4, 0, 0},
{ "TexCoord", GX2_SHADER_VAR_TYPE_FLOAT2, 0, 1},
};
static GX2AttribStream attribute_stream[] =
{
{0, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _1), GX2_ENDIAN_SWAP_DEFAULT},
{1, 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32,
GX2_ATTRIB_INDEX_PER_VERTEX, 0, GX2_COMP_SEL(_x, _y, _0, _0), GX2_ENDIAN_SWAP_DEFAULT},
};
static GX2SamplerVar samplers[] =
{
{ "Source", GX2_SAMPLER_VAR_TYPE_SAMPLER_2D, 0 },
};
static GX2UniformBlock uniform_blocks[] = {
{"UBO", 1, 96}
};
static GX2UniformVar uniform_vars[] = {
{"global.MVP", GX2_SHADER_VAR_TYPE_FLOAT, 1, 0, 0},
{"global.OutputSize", GX2_SHADER_VAR_TYPE_FLOAT, 1, 16, 0},
{"global.time", GX2_SHADER_VAR_TYPE_FLOAT, 1, 20, 0},
};
GX2Shader snowflake_shader =
{
{
{
.sq_pgm_resources_vs.num_gprs = 2,
.sq_pgm_resources_vs.stack_size = 1,
.spi_vs_out_config.vs_export_count = 0,
.num_spi_vs_out_id = 1,
{
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
{.semantic_0 = 0xFF, .semantic_1 = 0xFF, .semantic_2 = 0xFF, .semantic_3 = 0xFF},
},
.sq_vtx_semantic_clear = ~0x1,
.num_sq_vtx_semantic = 1,
{
0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
.vgt_vertex_reuse_block_cntl.vtx_reuse_depth = 0xE,
.vgt_hos_reuse_depth.reuse_depth = 0x10,
}, /* regs */
.size = sizeof(vs_program),
.program = (uint8_t*)&vs_program,
.mode = GX2_SHADER_MODE_UNIFORM_BLOCK,
.uniformBlockCount = countof(uniform_blocks), uniform_blocks,
.uniformVarCount = countof(uniform_vars), uniform_vars,
.attribVarCount = countof(attributes), attributes,
},
{
{
.sq_pgm_resources_ps.num_gprs = 3,
.sq_pgm_resources_ps.stack_size = 1,
.sq_pgm_exports_ps.export_mode = 0x2,
.spi_ps_in_control_0.num_interp = 1,
.spi_ps_in_control_0.position_ena = TRUE,
.spi_ps_in_control_0.persp_gradient_ena = FALSE,
.spi_ps_in_control_0.baryc_sample_cntl = spi_baryc_cntl_centers_only,
.num_spi_ps_input_cntl = 1, {{.semantic = 0, .default_val = 1}},
.cb_shader_mask.output0_enable = 0xF,
.cb_shader_control.rt0_enable = TRUE,
.db_shader_control.z_order = db_z_order_early_z_then_late_z,
}, /* regs */
.size = sizeof(ps_program),
.program = (uint8_t*)&ps_program,
.mode = GX2_SHADER_MODE_UNIFORM_BLOCK,
.samplerVarCount = countof(samplers), samplers,
},
.attribute_stream = attribute_stream,
};

View File

@ -0,0 +1,76 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) out vec4 FragColor;
vec2 uv;
float atime;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
float rand_float(float x)
{
return rand(vec2(x, 1.0));
}
float snow(vec3 pos, vec2 uv, float o)
{
vec2 d = (pos.xy - uv);
float a = atan(d.y,d.x) + sin(atime*1.0 + o) * 10.0;
float dist = d.x*d.x + d.y*d.y;
if(dist < pos.z/400.0)
{
float col = 0.0;
if(sin(a * 8.0) < 0.0)
{
col=1.0;
}
if(dist < pos.z/800.0)
{
col+=1.0;
}
return col * pos.z;
}
return 0.0;
}
float col(vec2 c)
{
float color = 0.0;
for (int i = 1; i < 3; i++)
{
float o = rand_float(float(i) / 3.0) * 15.0;
float z = rand_float(float(i) + 13.0);
float x = 1.8 - (3.6) * (rand_float(floor((global.time*((z + 1.0) / 2.0) +o) / 2.0)) + sin(global.time * o /1000.0) / 10.0);
float y = 1.0 - mod((global.time * ((z + 1.0)/2.0)) + o, 2.0);
color += snow(vec3(x,y,z), c, o);
}
return color;
}
void main(void)
{
uv = gl_FragCoord.xy / global.OutputSize.xy;
uv = uv * 2.0 - 1.0;
vec2 p = uv;
p.x *= global.OutputSize.x / global.OutputSize.y;
atime = (global.time + 1.0) / 4.0;
FragColor = vec4(col(p));
}

View File

@ -0,0 +1,18 @@
#version 150
uniform UBO
{
mat4 MVP;
vec2 OutputSize;
float time;
} global;
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
}

View File

@ -17,8 +17,8 @@
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "sprite_shader.h"
#include "gx2_shader_inl.h"
#include "sprite.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct

View File

@ -17,8 +17,8 @@
#include <malloc.h>
#include <string.h>
#include <wiiu/gx2/common.h>
#include "tex_shader.h"
#include "gx2_shader_inl.h"
#include "tex.h"
__attribute__((aligned(GX2_SHADER_ALIGNMENT)))
static struct

View File

@ -353,7 +353,7 @@ VIDEO DRIVER
#endif
#if defined(__wiiu__)
#include "../gfx/drivers/wiiu_gfx.c"
#include "../gfx/drivers/gx2_gfx.c"
#endif
#ifdef HAVE_SDL2

View File

@ -71,24 +71,50 @@ static void menu_display_wiiu_draw(void *data)
if(draw->pipeline.id)
{
if(draw->pipeline.id != VIDEO_SHADER_MENU)
return;
GX2SetShaderMode(GX2_SHADER_MODE_UNIFORM_BLOCK);
switch(draw->pipeline.id)
{
case VIDEO_SHADER_MENU:
GX2SetShader(&ribbon_shader);
GX2SetVertexUniformBlock(ribbon_shader.vs.uniformBlocks[0].offset,
ribbon_shader.vs.uniformBlocks[0].size,
wiiu->ribbon_ubo);
GX2SetAttribBuffer(0, draw->coords->vertices * 2 * sizeof(float), 2 * sizeof(float), wiiu->menu_display_coord_array);
GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_ONE,
GX2_BLEND_COMBINE_MODE_ADD, GX2_DISABLE, 0, 0, 0);
break;
case VIDEO_SHADER_MENU_2:
GX2SetShader(&ribbon_simple_shader);
break;
case VIDEO_SHADER_MENU_3:
GX2SetShader(&snow_simple_shader);
break;
case VIDEO_SHADER_MENU_4:
GX2SetShader(&snow_shader);
break;
case VIDEO_SHADER_MENU_5:
GX2SetShader(&bokeh_shader);
break;
case VIDEO_SHADER_MENU_6:
GX2SetShader(&snowflake_shader);
break;
default:
break;
}
switch(draw->pipeline.id)
{
case VIDEO_SHADER_MENU:
case VIDEO_SHADER_MENU_2:
GX2DrawEx(GX2_PRIMITIVE_MODE_TRIANGLE_STRIP, draw->coords->vertices, 0, 1);
GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA,
GX2_BLEND_COMBINE_MODE_ADD,
GX2_ENABLE, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA,
GX2_BLEND_COMBINE_MODE_ADD);
case VIDEO_SHADER_MENU_3:
case VIDEO_SHADER_MENU_4:
case VIDEO_SHADER_MENU_5:
case VIDEO_SHADER_MENU_6:
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);
break;
}
}
else if(draw->coords->vertex || draw->coords->color[0] != draw->coords->color[12])
{
@ -218,24 +244,52 @@ static void menu_display_wiiu_draw_pipeline(void *data)
video_coord_array_t *ca = NULL;
if (!wiiu || !draw || draw->pipeline.id != VIDEO_SHADER_MENU)
if (!wiiu || !draw)
return;
ca = menu_display_get_coords_array();
if(!wiiu->menu_display_coord_array)
switch(draw->pipeline.id)
{
wiiu->menu_display_coord_array = MEM2_alloc(ca->coords.vertices * 2 * sizeof(float), GX2_VERTEX_BUFFER_ALIGNMENT);
memcpy(wiiu->menu_display_coord_array, ca->coords.vertex, ca->coords.vertices * 2 * sizeof(float));
wiiu->ribbon_ubo = MEM2_alloc(sizeof(*wiiu->ribbon_ubo), GX2_UNIFORM_BLOCK_ALIGNMENT);
wiiu->ribbon_ubo->time = 0.0f;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->menu_display_coord_array, ca->coords.vertices * 2 * sizeof(float));
case VIDEO_SHADER_MENU:
case VIDEO_SHADER_MENU_2:
ca = menu_display_get_coords_array();
if(!wiiu->menu_shader_vbo)
{
wiiu->menu_shader_vbo = MEM2_alloc(ca->coords.vertices * 2 * sizeof(float), GX2_VERTEX_BUFFER_ALIGNMENT);
memcpy(wiiu->menu_shader_vbo, ca->coords.vertex, ca->coords.vertices * 2 * sizeof(float));
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->menu_shader_vbo, ca->coords.vertices * 2 * sizeof(float));
}
draw->coords->vertex = wiiu->menu_display_coord_array;
draw->coords->vertex = wiiu->menu_shader_vbo;
draw->coords->vertices = ca->coords.vertices;
GX2SetAttribBuffer(0, draw->coords->vertices * 2 * sizeof(float), 2 * sizeof(float), wiiu->menu_shader_vbo);
GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_ONE,
GX2_BLEND_COMBINE_MODE_ADD, GX2_DISABLE, 0, 0, 0);
wiiu->ribbon_ubo->time += 0.01;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_UNIFORM_BLOCK, wiiu->ribbon_ubo, sizeof(*wiiu->ribbon_ubo));
break;
case VIDEO_SHADER_MENU_3:
case VIDEO_SHADER_MENU_4:
case VIDEO_SHADER_MENU_5:
case VIDEO_SHADER_MENU_6:
GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->v), sizeof(*wiiu->v), wiiu->v);
break;
default:
return;
}
if(!wiiu->menu_shader_ubo)
{
wiiu->menu_shader_ubo = MEM2_alloc(sizeof(*wiiu->menu_shader_ubo), GX2_UNIFORM_BLOCK_ALIGNMENT);
matrix_4x4_ortho(wiiu->menu_shader_ubo->mvp, 0, 1, 1, 0, -1, 1);
wiiu->menu_shader_ubo->OutputSize.width = wiiu->color_buffer.surface.width;
wiiu->menu_shader_ubo->OutputSize.height = wiiu->color_buffer.surface.height;
wiiu->menu_shader_ubo->time = 0.0f;
}
else
wiiu->menu_shader_ubo->time += 0.01f;
GX2Invalidate(GX2_INVALIDATE_MODE_CPU_UNIFORM_BLOCK, wiiu->menu_shader_ubo, sizeof(*wiiu->menu_shader_ubo));
GX2SetVertexUniformBlock(1, sizeof(*wiiu->menu_shader_ubo), wiiu->menu_shader_ubo);
GX2SetPixelUniformBlock(1, sizeof(*wiiu->menu_shader_ubo), wiiu->menu_shader_ubo);
}
static void menu_display_wiiu_restore_clear_color(void)

View File

@ -69,6 +69,11 @@
#define KCACHE0(bank, mode) | to_QWORD(CF_ALU_WORD0(0, bank, 0, mode), 0)
#define KCACHE1(bank, mode) | to_QWORD(CF_ALU_WORD0(0, 0, bank, 0), CF_ALU_WORD1(mode,0, 0, 0, 0, 0))
#define DEACTIVATE 1
#define UPDATE_EXEC_MASK(mode) | to_QWORD(0, to_LE(mode << 2))
#define UPDATE_PRED | to_QWORD(0, to_LE(1ull << 3))
#define CLAMP | to_QWORD(0, to_LE(1ull << 31))
#define ALU_LAST | to_QWORD(to_LE(1ull << 31), 0)
/* ALU */
@ -139,6 +144,7 @@
#define ALU_SRC_PS 0xFF
#define _NEG | (1 << 12)
#define _ABS | (1 << 13)
#define ALU_OMOD_OFF 0x0
#define ALU_OMOD_M2 0x1
@ -195,24 +201,41 @@
/* CF */
#define CF_INST_TEX 0x01
#define CF_INST_VTX 0x02
#define CF_INST_ALU 0x08
#define CF_INST_JUMP 0x0A
#define CF_INST_ELSE 0x0D
#define CF_INST_CALL_FS 0x13
#define CF_INST_EMIT_VERTEX 0x15
#define CF_INST_MEM_RING 0x26
#define CF_INST_ALU 0x08
#define CF_INST_ALU_PUSH_BEFORE 0x09
#define CF_INST_ALU_POP_AFTER 0x0A
/* ALU */
#define OP2_INST_ADD 0x0
#define OP2_INST_MUL 0x1
#define OP2_INST_MUL_IEEE 0x2
#define OP2_INST_MIN 0x04
#define OP2_INST_MAX 0x03
#define OP2_INST_MAX_DX10 0x05
#define OP2_INST_FRACT 0x10
#define OP2_INST_SETGT 0x09
#define OP2_INST_SETE_DX10 0x0C
#define OP2_INST_SETGT_DX10 0x0D
#define OP2_INST_FLOOR 0x14
#define OP2_INST_MOV 0x19
#define OP2_INST_PRED_SETGT 0x21
#define OP2_INST_PRED_SETE_INT 0x42
#define OP2_INST_DOT4 0x50
#define OP2_INST_DOT4_IEEE 0x51
#define OP2_INST_RECIP_IEEE 0x66
#define OP2_INST_RECIPSQRT_IEEE 0x69
#define OP2_INST_SQRT_IEEE 0x6A
#define OP2_INST_SIN 0x6E
#define OP2_INST_COS 0x6F
#define OP3_INST_MULADD 0x10
#define OP3_INST_CNDGT 0x19
#define OP3_INST_CNDE_INT 0x1C
/* EXP */
#define CF_INST_EXP 0x27
#define CF_INST_EXP_DONE 0x28
@ -288,8 +311,12 @@
#define TEX(addr, cnt) to_QWORD(CF_DWORD0(addr), CF_DWORD1(0x0, 0x0, CF_COND_ACTIVE, (cnt - 1), 0x0, CF_INST_TEX))
#define VTX(addr, cnt) to_QWORD(CF_DWORD0(addr), CF_DWORD1(0x0, 0x0, CF_COND_ACTIVE, (cnt - 1), 0x0, CF_INST_VTX))
#define JUMP(popCount, addr) to_QWORD(CF_DWORD0(addr), CF_DWORD1(popCount, 0x0, CF_COND_ACTIVE, 0x0, 0x0, CF_INST_JUMP))
#define ELSE(popCount, addr) to_QWORD(CF_DWORD0(addr), CF_DWORD1(popCount, 0x0, CF_COND_ACTIVE, 0x0, 0x0, CF_INST_ELSE))
#define ALU(addr, cnt) to_QWORD(CF_ALU_WORD0(addr, 0x0, 0x0, 0x0), CF_ALU_WORD1(0x0, 0x0, 0x0, (cnt - 1), 0x0, CF_INST_ALU))
#define ALU_PUSH_BEFORE(addr, cnt) to_QWORD(CF_ALU_WORD0(addr, 0x0, 0x0, 0x0), CF_ALU_WORD1(0x0, 0x0, 0x0, (cnt - 1), 0x0, CF_INST_ALU_PUSH_BEFORE))
#define ALU_POP_AFTER(addr, cnt) to_QWORD(CF_ALU_WORD0(addr, 0x0, 0x0, 0x0), CF_ALU_WORD1(0x0, 0x0, 0x0, (cnt - 1), 0x0, CF_INST_ALU_POP_AFTER))
#define EXP_DONE(dstReg_and_type, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW) to_QWORD(CF_EXP_WORD0(dstReg_and_type, srcReg, 0x0, 0x0, 0x0), \
CF_EXP_WORD1(srcSelX, srcSelY, srcSelZ, srcSelW, 0x0, CF_INST_EXP_DONE))
@ -304,8 +331,8 @@
#define EMIT_VERTEX to_QWORD(0, CF_DWORD1(0, 0, 0, 0, 0, CF_INST_EMIT_VERTEX))
#define ALU_OP2(inst, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, omod) \
to_QWORD(ALU_WORD0(src0Sel, 0x0, src0Chan, 0x0, src1Sel, 0x0, src1Chan, 0x0, 0x0, 0x0), \
ALU_WORD1_OP2(0x0, 0x0, 0x0, 0x0, (((dstGpr&__) >> 7) ^ 0x1), omod, inst, 0x0, 0x0, dstGpr, 0x0, dstChan, 0x0))
to_QWORD(ALU_WORD0(((src0Sel) & ((1 << 13) - 1)), 0x0, src0Chan, 0x0, ((src1Sel) & ((1 << 13) - 1)), 0x0, src1Chan, 0x0, 0x0, 0x0), \
ALU_WORD1_OP2(((src0Sel) >> 13), ((src1Sel) >> 13), 0x0, 0x0, (((dstGpr&__) >> 7) ^ 0x1), omod, inst, 0x0, 0x0, dstGpr, 0x0, dstChan, 0x0))
#define ALU_OP3(inst, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \
to_QWORD(ALU_WORD0(src0Sel, 0x0, src0Chan, 0x0, src1Sel, 0x0, src1Chan, 0x0, 0x0, 0x0), \
@ -317,21 +344,45 @@
#define ALU_ADD_x2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_ADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M2)
#define ALU_ADD_D2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_ADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_D2)
#define ALU_MUL(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MUL, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_MUL_x2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MUL, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M2)
#define ALU_MUL_x4(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MUL, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M4)
#define ALU_MUL_IEEE(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MUL_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_MUL_IEEE_x2(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MUL_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M2)
#define ALU_MUL_IEEE_x4(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MUL_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_M4)
#define ALU_FRACT(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_FRACT, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF)
#define ALU_FLOOR(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_FLOOR, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF)
#define ALU_SQRT_IEEE(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_SQRT_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF)
#define ALU_SQRT_IEEE_D2(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_SQRT_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_D2)
#define ALU_MOV(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF)
#define ALU_MOV_D2(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_D2)
#define ALU_MOV_x2(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_MOV, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_M2)
@ -341,6 +392,33 @@
#define ALU_DOT4_IEEE(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_DOT4_IEEE, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_DOT4(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_DOT4, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_PRED_SETGT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_PRED_SETGT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_SETE_DX10(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_SETE_DX10, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_SETGT_DX10(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_SETGT_DX10, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_SETGT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_SETGT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_PRED_SETE_INT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_PRED_SETE_INT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_MIN(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MIN, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_MAX(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MAX, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_MAX_DX10(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan) \
ALU_OP2(OP2_INST_MAX_DX10, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, ALU_OMOD_OFF)
#define ALU_RECIP_IEEE(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_RECIP_IEEE, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF)
@ -353,9 +431,18 @@
#define ALU_COS(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_COS, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_OFF)
#define ALU_COS_D2(dstGpr, dstChan, src0Sel, src0Chan) \
ALU_OP2(OP2_INST_COS, dstGpr, dstChan, src0Sel, src0Chan, ALU_SRC_0, 0x0, ALU_OMOD_D2)
#define ALU_MULADD(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \
ALU_OP3(OP3_INST_MULADD, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan)
#define ALU_CNDGT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \
ALU_OP3(OP3_INST_CNDGT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan)
#define ALU_CNDE_INT(dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan) \
ALU_OP3(OP3_INST_CNDE_INT, dstGpr, dstChan, src0Sel, src0Chan, src1Sel, src1Chan, src2Sel, src2Chan)
#define TEX_SAMPLE(dstReg, dstSelX, dstSelY, dstSelZ, dstSelW, srcReg, srcSelX, srcSelY, srcSelZ, srcSelW, resourceID, samplerID)\
to_QWORD(TEX_WORD0(TEX_INST_SAMPLE, 0x0, 0x0, resourceID, srcReg, 0x0, 0x0), \
TEX_WORD1(dstReg, 0x0, dstSelX, dstSelY, dstSelZ, dstSelW, 0x0, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED, TEX_NORMALIZED)), \