diff options
author | WlodekM <[email protected]> | 2024-06-16 10:35:45 +0300 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-06-16 10:35:45 +0300 |
commit | abef6da56913f1c55528103e60a50451a39628b1 (patch) | |
tree | b3c8092471ecbb73e568cd0d336efa0e7871ee8d /misc/wiiu |
initial commit
Diffstat (limited to 'misc/wiiu')
-rw-r--r-- | misc/wiiu/Makefile | 174 | ||||
-rw-r--r-- | misc/wiiu/coloured.gsh | bin | 0 -> 1312 bytes | |||
-rw-r--r-- | misc/wiiu/coloured.psh | 8 | ||||
-rw-r--r-- | misc/wiiu/coloured.psh.glsl | 6 | ||||
-rw-r--r-- | misc/wiiu/coloured.vsh | 46 | ||||
-rw-r--r-- | misc/wiiu/coloured.vsh.glsl | 9 | ||||
-rw-r--r-- | misc/wiiu/shaders.txt | 14 | ||||
-rw-r--r-- | misc/wiiu/textured.gsh | bin | 0 -> 1780 bytes | |||
-rw-r--r-- | misc/wiiu/textured.psh | 21 | ||||
-rw-r--r-- | misc/wiiu/textured.psh.glsl | 9 | ||||
-rw-r--r-- | misc/wiiu/textured.vsh | 55 | ||||
-rw-r--r-- | misc/wiiu/textured.vsh.glsl | 12 | ||||
-rw-r--r-- | misc/wiiu/textured_offset.vsh | 64 | ||||
-rw-r--r-- | misc/wiiu/textured_offset.vsh.glsl | 13 |
14 files changed, 431 insertions, 0 deletions
diff --git a/misc/wiiu/Makefile b/misc/wiiu/Makefile new file mode 100644 index 0000000..47bad6d --- /dev/null +++ b/misc/wiiu/Makefile @@ -0,0 +1,174 @@ +#------------------------------------------------------------------------------- +.SUFFIXES: +#------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro") +endif + +TOPDIR ?= $(CURDIR) + +#------------------------------------------------------------------------------- +# APP_NAME sets the long name of the application +# APP_SHORTNAME sets the short name of the application +# APP_AUTHOR sets the author of the application +#------------------------------------------------------------------------------- +#APP_NAME := Application Name +#APP_SHORTNAME := App Name +#APP_AUTHOR := Built with devkitPPC & wut + +include $(DEVKITPRO)/wut/share/wut_rules + +#------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# CONTENT is the path to the bundled folder that will be mounted as /vol/content/ +# ICON is the game icon, leave blank to use default rule +# TV_SPLASH is the image displayed during bootup on the TV, leave blank to use default rule +# DRC_SPLASH is the image displayed during bootup on the DRC, leave blank to use default rule +#------------------------------------------------------------------------------- +TARGET := ClassiCube-wiiu +BUILD := build-wiiu +SOURCES := src third_party/bearssl/src +SHADERS := misc/wiiu +DATA := data +INCLUDES := third_party/bearssl/inc +CONTENT := +ICON := +TV_SPLASH := +DRC_SPLASH := + +#------------------------------------------------------------------------------- +# options for code generation +#------------------------------------------------------------------------------- +CFLAGS := -g -Wall -O2 -ffunction-sections -fno-math-errno \ + $(MACHDEP) + +CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ + +CXXFLAGS := $(CFLAGS) + +ASFLAGS := -g $(ARCH) +LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) + +LIBS := -lwut -lm + +#------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level +# containing include and lib +#------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(WUT_ROOT) + +#------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) \ + $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.gsh))) + +export LD := $(CXX) + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SRC) +export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +ifneq (,$(strip $(CONTENT))) + export APP_CONTENT := $(TOPDIR)/$(CONTENT) +endif + +ifneq (,$(strip $(ICON))) + export APP_ICON := $(TOPDIR)/$(ICON) +else ifneq (,$(wildcard $(TOPDIR)/$(TARGET).png)) + export APP_ICON := $(TOPDIR)/$(TARGET).png +else ifneq (,$(wildcard $(TOPDIR)/icon.png)) + export APP_ICON := $(TOPDIR)/icon.png +endif + +ifneq (,$(strip $(TV_SPLASH))) + export APP_TV_SPLASH := $(TOPDIR)/$(TV_SPLASH) +else ifneq (,$(wildcard $(TOPDIR)/tv-splash.png)) + export APP_TV_SPLASH := $(TOPDIR)/tv-splash.png +else ifneq (,$(wildcard $(TOPDIR)/splash.png)) + export APP_TV_SPLASH := $(TOPDIR)/splash.png +endif + +ifneq (,$(strip $(DRC_SPLASH))) + export APP_DRC_SPLASH := $(TOPDIR)/$(DRC_SPLASH) +else ifneq (,$(wildcard $(TOPDIR)/drc-splash.png)) + export APP_DRC_SPLASH := $(TOPDIR)/drc-splash.png +else ifneq (,$(wildcard $(TOPDIR)/splash.png)) + export APP_DRC_SPLASH := $(TOPDIR)/splash.png +endif + +.PHONY: $(BUILD) clean all + +#------------------------------------------------------------------------------- +all: $(BUILD) + +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/misc/wiiu/Makefile + +#------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(TARGET).wuhb $(TARGET).rpx $(TARGET).elf + +#------------------------------------------------------------------------------- +else +.PHONY: all + +DEPENDS := $(OFILES:.o=.d) + +#------------------------------------------------------------------------------- +# main targets +#------------------------------------------------------------------------------- +all : $(OUTPUT).wuhb + +$(OUTPUT).wuhb : $(OUTPUT).rpx +$(OUTPUT).rpx : $(OUTPUT).elf +$(OUTPUT).elf : $(OFILES) + +$(OFILES_SRC) : $(HFILES_BIN) + +# you need a rule like this for each extension you use as binary data +#------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) +#------------------------------------------------------------------------------- +%.gsh.o %_gsh.h : ../misc/wiiu/%.gsh +#------------------------------------------------------------------------------- + echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#------------------------------------------------------------------------------- +endif +#------------------------------------------------------------------------------- diff --git a/misc/wiiu/coloured.gsh b/misc/wiiu/coloured.gsh new file mode 100644 index 0000000..22a1131 --- /dev/null +++ b/misc/wiiu/coloured.gsh Binary files differdiff --git a/misc/wiiu/coloured.psh b/misc/wiiu/coloured.psh new file mode 100644 index 0000000..3248826 --- /dev/null +++ b/misc/wiiu/coloured.psh @@ -0,0 +1,8 @@ +; $NUM_SPI_PS_INPUT_CNTL = 1 +; $SPI_PS_INPUT_CNTL[0].SEMANTIC = 0 +; $SPI_PS_INPUT_CNTL[0].DEFAULT_VAL = 1 +; $SQ_PGM_RESOURCES_PS.STACK_SIZE = 0 + +; -------- Disassembly -------------------- +00 EXP_DONE: PIX0, R0 +END_OF_PROGRAM diff --git a/misc/wiiu/coloured.psh.glsl b/misc/wiiu/coloured.psh.glsl new file mode 100644 index 0000000..fae46dd --- /dev/null +++ b/misc/wiiu/coloured.psh.glsl @@ -0,0 +1,6 @@ +varying vec4 out_col; + +void main() { + vec4 col = out_col; + gl_FragColor = col; +} \ No newline at end of file diff --git a/misc/wiiu/coloured.vsh b/misc/wiiu/coloured.vsh new file mode 100644 index 0000000..1f57c2b --- /dev/null +++ b/misc/wiiu/coloured.vsh @@ -0,0 +1,46 @@ +; $MODE = "UniformRegister" + +; $SPI_VS_OUT_CONFIG.VS_EXPORT_COUNT = 0 +; $NUM_SPI_VS_OUT_ID = 1 +; out_colour +; $SPI_VS_OUT_ID[0].SEMANTIC_0 = 0 + +; C0 +; $UNIFORM_VARS[0].name = "mvp" +; $UNIFORM_VARS[0].type = "mat4" +; $UNIFORM_VARS[0].count = 1 +; $UNIFORM_VARS[0].block = -1 +; $UNIFORM_VARS[0].offset = 0 + +; R1 +; $ATTRIB_VARS[0].name = "in_pos" +; $ATTRIB_VARS[0].type = "vec3" +; $ATTRIB_VARS[0].location = 0 +; R2 +; $ATTRIB_VARS[1].name = "in_col" +; $ATTRIB_VARS[1].type = "vec4" +; $ATTRIB_VARS[1].location = 1 + +; -------- Disassembly -------------------- +00 CALL_FS NO_BARRIER +01 ALU: ADDR(32) CNT(18) + 0 x: MUL ____, C3.w, 1.0f + y: MUL ____, C3.z, 1.0f + z: MUL ____, C3.y, 1.0f + w: MUL ____, C3.x, 1.0f + 1 x: MULADD R127.x, R1.z, C2.w, PV0.x + y: MULADD R127.y, R1.z, C2.z, PV0.y + z: MULADD R127.z, R1.z, C2.y, PV0.z + w: MULADD R127.w, R1.z, C2.x, PV0.w + 2 x: MULADD R127.x, R1.y, C1.w, PV1.x + y: MULADD R127.y, R1.y, C1.z, PV1.y + z: MULADD R127.z, R1.y, C1.y, PV1.z + w: MULADD R127.w, R1.y, C1.x, PV1.w + 3 x: MULADD R1.x, R1.x, C0.x, PV2.w + y: MULADD R1.y, R1.x, C0.y, PV2.z + z: MULADD R1.z, R1.x, C0.z, PV2.y + w: MULADD R1.w, R1.x, C0.w, PV2.x +02 EXP_DONE: POS0, R1 +03 EXP_DONE: PARAM0, R2 NO_BARRIER +END_OF_PROGRAM + diff --git a/misc/wiiu/coloured.vsh.glsl b/misc/wiiu/coloured.vsh.glsl new file mode 100644 index 0000000..a160758 --- /dev/null +++ b/misc/wiiu/coloured.vsh.glsl @@ -0,0 +1,9 @@ +attribute vec3 in_pos; +attribute vec4 in_col; +varying vec4 out_col; +uniform mat4 mvp; + +void main() { + gl_Position = mvp * vec4(in_pos, 1.0); + out_col = in_col; +} diff --git a/misc/wiiu/shaders.txt b/misc/wiiu/shaders.txt new file mode 100644 index 0000000..cca3c2b --- /dev/null +++ b/misc/wiiu/shaders.txt @@ -0,0 +1,14 @@ +Shader samples +https://github.com/decaf-emu/wiiu-tests/blob/master/content/shaders/pos_colour.vsh +https://github.com/GaryOderNichts/wiiu-shaders/blob/master/shaders.md +https://github.com/luRaichu/recsbr/blob/163fa441712f6b25e780e914617941c2385b330e/src/Backends/Rendering/WiiUShaders/shader%20sources/plain.vsh#L6 +https://github.com/GaryOderNichts/MultiDRCSpaceDemo/blob/30a6337a47dabafd6d601ce0555b326866f63247/shaders/textureShader.vsh#L6 +https://github.com/luRaichu/recsbr/blob/163fa441712f6b25e780e914617941c2385b330e/src/Backends/Rendering/WiiUShaders/shader%20sources/texture.vsh#L9 +https://github.com/rw-r-r-0644/gx2-texture/blob/83d7707e8d4b33ec7ba63d5c7dfe62c359b2b50a/shaders/texture_shader.vsh#L9 +https://github.com/yawut/ntrview-wiiu/blob/45b1c7f05cfd9917b8b171f3db08dc63293fc5c5/gfx/gx2_shaders/main.psh +https://github.com/Hydr8gon/NooDS/blob/b41cb3b9b889481c998e7e83db1ab3ef9d97b838/src/console/shaders/shader_wiiu.vsh +https://github.com/luRaichu/recsbr/blob/163fa441712f6b25e780e914617941c2385b330e/src/Backends/Rendering/WiiUShaders/shader%20sources/wtf%20is%20this.txt + +To generate shader assembly +1) Get AMD ShaderAnalyzer +2) Select Radeon HD 4670 (RV370) Assembly as the output format \ No newline at end of file diff --git a/misc/wiiu/textured.gsh b/misc/wiiu/textured.gsh new file mode 100644 index 0000000..cd3fb3b --- /dev/null +++ b/misc/wiiu/textured.gsh Binary files differdiff --git a/misc/wiiu/textured.psh b/misc/wiiu/textured.psh new file mode 100644 index 0000000..9305d3e --- /dev/null +++ b/misc/wiiu/textured.psh @@ -0,0 +1,21 @@ +; $MODE = "UniformRegister" +; $SAMPLER_VARS[0].name= "texImage" +; $SAMPLER_VARS[0].type= "sampler2D" +; $SAMPLER_VARS[0].location = 0 + +; $NUM_SPI_PS_INPUT_CNTL = 2 +; $SPI_PS_INPUT_CNTL[0].semantic = 0 +; $SPI_PS_INPUT_CNTL[0].default_val = 1 +; $SPI_PS_INPUT_CNTL[1].semantic = 1 +; $SPI_PS_INPUT_CNTL[1].default_val = 1 + +; -------- Disassembly -------------------- +00 TEX: ADDR(48) CNT(1) VALID_PIX + 0 SAMPLE R1, R1.xy0x, t0, s0 +01 ALU: ADDR(32) CNT(4) + 1 x: MUL R0.x, R0.x, R1.x + y: MUL R0.y, R0.y, R1.y + z: MUL R0.z, R0.z, R1.z + w: MUL R0.w, R0.w, R1.w +02 EXP_DONE: PIX0, R0 +END_OF_PROGRAM \ No newline at end of file diff --git a/misc/wiiu/textured.psh.glsl b/misc/wiiu/textured.psh.glsl new file mode 100644 index 0000000..71ef45b --- /dev/null +++ b/misc/wiiu/textured.psh.glsl @@ -0,0 +1,9 @@ +varying vec4 out_col; +varying vec2 out_uv; +uniform sampler2D texImage; + +void main() { + vec4 col = texture(texImage, out_uv) * out_col; + gl_FragColor = col; +} + diff --git a/misc/wiiu/textured.vsh b/misc/wiiu/textured.vsh new file mode 100644 index 0000000..dc021e5 --- /dev/null +++ b/misc/wiiu/textured.vsh @@ -0,0 +1,55 @@ +; $MODE = "UniformRegister" + +; $SPI_VS_OUT_CONFIG.VS_EXPORT_COUNT = 1 +; $NUM_SPI_VS_OUT_ID = 1 +; out_colour +; $SPI_VS_OUT_ID[0].SEMANTIC_0 = 0 +; out_uv +; $SPI_VS_OUT_ID[0].SEMANTIC_1 = 1 + +; C0 +; $UNIFORM_VARS[0].name = "mvp" +; $UNIFORM_VARS[0].type = "mat4" +; $UNIFORM_VARS[0].count = 1 +; $UNIFORM_VARS[0].block = -1 +; $UNIFORM_VARS[0].offset = 0 + +; R1 +; $ATTRIB_VARS[0].name = "in_pos" +; $ATTRIB_VARS[0].type = "vec3" +; $ATTRIB_VARS[0].location = 0 +; R2 +; $ATTRIB_VARS[1].name = "in_col" +; $ATTRIB_VARS[1].type = "vec4" +; $ATTRIB_VARS[1].location = 1 +; R3 +; $ATTRIB_VARS[2].name = "in_uv" +; $ATTRIB_VARS[2].type = "vec2" +; $ATTRIB_VARS[2].location = 2 + +; -------- Disassembly -------------------- +00 CALL_FS NO_BARRIER +01 ALU: ADDR(32) CNT(20) + 0 x: MUL ____, C3.y, 1.0f + y: MUL ____, C3.x, 1.0f + z: MUL ____, C3.w, 1.0f + w: MUL ____, C3.z, 1.0f + t: MOV R0.x, R3.x + 1 x: MULADD R127.x, R1.z, C2.y, PV0.x + y: MULADD R127.y, R1.z, C2.x, PV0.y + z: MULADD R127.z, R1.z, C2.w, PV0.z + w: MULADD R127.w, R1.z, C2.z, PV0.w + t: MOV R0.y, R3.y + 2 x: MULADD R127.x, R1.y, C1.y, PV1.x + y: MULADD R127.y, R1.y, C1.x, PV1.y + z: MULADD R127.z, R1.y, C1.w, PV1.z + w: MULADD R127.w, R1.y, C1.z, PV1.w + 3 x: MULADD R1.x, R1.x, C0.x, PV2.y + y: MULADD R1.y, R1.x, C0.y, PV2.x + z: MULADD R1.z, R1.x, C0.z, PV2.w + w: MULADD R1.w, R1.x, C0.w, PV2.z +02 EXP_DONE: POS0, R1 +03 EXP: PARAM0, R2 NO_BARRIER +04 EXP_DONE: PARAM1, R0.xyzz NO_BARRIER +END_OF_PROGRAM + diff --git a/misc/wiiu/textured.vsh.glsl b/misc/wiiu/textured.vsh.glsl new file mode 100644 index 0000000..d7a805d --- /dev/null +++ b/misc/wiiu/textured.vsh.glsl @@ -0,0 +1,12 @@ +attribute vec3 in_pos; +attribute vec4 in_col; +attribute vec2 in_uv; +varying vec4 out_col; +varying vec2 out_uv; +uniform mat4 mvp; + +void main() { + gl_Position = mvp * vec4(in_pos, 1.0); + out_col = in_col; + out_uv = in_uv; +} diff --git a/misc/wiiu/textured_offset.vsh b/misc/wiiu/textured_offset.vsh new file mode 100644 index 0000000..e750be6 --- /dev/null +++ b/misc/wiiu/textured_offset.vsh @@ -0,0 +1,64 @@ +; $MODE = "UniformRegister" + +; $SPI_VS_OUT_CONFIG.VS_EXPORT_COUNT = 1 +; $NUM_SPI_VS_OUT_ID = 1 +; out_colour +; $SPI_VS_OUT_ID[0].SEMANTIC_0 = 0 +; out_uv +; $SPI_VS_OUT_ID[0].SEMANTIC_1 = 1 + +; C0 +; $UNIFORM_VARS[0].name = "mvp" +; $UNIFORM_VARS[0].type = "mat4" +; $UNIFORM_VARS[0].count = 1 +; $UNIFORM_VARS[0].block = -1 +; $UNIFORM_VARS[0].offset = 0 +; C4 (MIGHT BE WRONG AND SHOULD BE [3] instead??? ) +; $UNIFORM_VARS[1].name = "texOffset" +; $UNIFORM_VARS[1].type = "vec2" +; $UNIFORM_VARS[1].count = 1 +; $UNIFORM_VARS[1].block = -1 +; $UNIFORM_VARS[1].offset = 0 + +; R1 +; $ATTRIB_VARS[0].name = "in_pos" +; $ATTRIB_VARS[0].type = "vec3" +; $ATTRIB_VARS[0].location = 0 +; R2 +; $ATTRIB_VARS[1].name = "in_col" +; $ATTRIB_VARS[1].type = "vec4" +; $ATTRIB_VARS[1].location = 1 +; R3 +; $ATTRIB_VARS[2].name = "in_uv" +; $ATTRIB_VARS[2].type = "vec2" +; $ATTRIB_VARS[2].location = 2 + +; -------- Disassembly -------------------- +00 CALL_FS NO_BARRIER +01 ALU: ADDR(32) CNT(18) + 0 x: MUL ____, C3.y, 1.0f + y: MUL ____, C3.x, 1.0f + z: MUL ____, C3.w, 1.0f + w: MUL ____, C3.z, 1.0f + 1 x: MULADD R127.x, R2.z, C2.y, PV0.x + y: MULADD R127.y, R2.z, C2.x, PV0.y + z: MULADD R127.z, R2.z, C2.w, PV0.z + w: MULADD R127.w, R2.z, C2.z, PV0.w + 2 x: MULADD R127.x, R2.y, C1.y, PV1.x + y: MULADD R127.y, R2.y, C1.x, PV1.y + z: MULADD R127.z, R2.y, C1.w, PV1.z + w: MULADD R127.w, R2.y, C1.z, PV1.w + 3 x: MULADD R2.x, R2.x, C0.x, PV2.y + y: MULADD R2.y, R2.x, C0.y, PV2.x + z: MULADD R2.z, R2.x, C0.z, PV2.w + w: MULADD R2.w, R2.x, C0.w, PV2.z + 4 x: ADD R3.x, R3.x, C4.x + y: ADD R3.y, R3.y, C4.y +02 EXP_DONE: POS0, R2 +03 EXP: PARAM0, R1 NO_BARRIER +04 EXP_DONE: PARAM1, R3.xyzz NO_BARRIER +05 ALU: ADDR(50) CNT(1) + 5 x: NOP ____ +06 NOP NO_BARRIER +END_OF_PROGRAM + diff --git a/misc/wiiu/textured_offset.vsh.glsl b/misc/wiiu/textured_offset.vsh.glsl new file mode 100644 index 0000000..7248768 --- /dev/null +++ b/misc/wiiu/textured_offset.vsh.glsl @@ -0,0 +1,13 @@ +attribute vec3 in_pos; +attribute vec4 in_col; +attribute vec2 in_uv; +varying vec4 out_col; +varying vec2 out_uv; +uniform mat4 mvp; +uniform vec2 texOffset; + +void main() { + gl_Position = mvp * vec4(in_pos, 1.0); + out_col = in_col; + out_uv = in_uv + texOffset; +} \ No newline at end of file |