From 8e86af967a524e0ab9761dbbe564b2510613bce4 Mon Sep 17 00:00:00 2001 From: smea Date: Mon, 25 Aug 2014 23:26:36 -0700 Subject: [PATCH] added Makefile rule to compile vsh shader code to gpu example (fincs, can you see if you can improve it ?) --- examples/gpu/Makefile | 14 +++++++++++++- examples/gpu/{source => data}/test.vsh | 0 examples/gpu/source/main.c | 4 ++-- libctru/include/3ds/3ds.h | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) rename examples/gpu/{source => data}/test.vsh (100%) diff --git a/examples/gpu/Makefile b/examples/gpu/Makefile index c0eae79..af6ce87 100644 --- a/examples/gpu/Makefile +++ b/examples/gpu/Makefile @@ -130,7 +130,19 @@ $(OUTPUT).elf : $(OFILES) %.bin.o : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) - @$(bin2o) + $(bin2o) + +# not the right way to do this +#--------------------------------------------------------------------------------- +%.vsh.o : %.vsh +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin + @bin2s ../$(notdir $<).shbin | arm-none-eabi-as -o $@ + echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h + echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h + echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h + @rm ../$(notdir $<).shbin -include $(DEPENDS) diff --git a/examples/gpu/source/test.vsh b/examples/gpu/data/test.vsh similarity index 100% rename from examples/gpu/source/test.vsh rename to examples/gpu/data/test.vsh diff --git a/examples/gpu/source/main.c b/examples/gpu/source/main.c index e521923..7623db0 100644 --- a/examples/gpu/source/main.c +++ b/examples/gpu/source/main.c @@ -4,7 +4,7 @@ #include #include <3ds/3ds.h> #include "math.h" -#include "test_shbin.h" +#include "test_vsh_shbin.h" #include "test_png_bin.h" #include "mdl.h" @@ -172,7 +172,7 @@ int main() memcpy(vertArray, mdlData, sizeof(mdlData)); tx=ty=0.0f; tz=-0.1f; - shader=SHDR_ParseSHBIN((u32*)test_shbin,test_shbin_size); + shader=SHDR_ParseSHBIN((u32*)test_vsh_shbin,test_vsh_shbin_size); GX_SetMemoryFill(gxCmdBuf, (u32*)gpuOut, 0x404040FF, (u32*)&gpuOut[0x2EE00], 0x201, (u32*)gpuDOut, 0x00000000, (u32*)&gpuDOut[0x2EE00], 0x201); gfxSwapBuffersGpu(); diff --git a/libctru/include/3ds/3ds.h b/libctru/include/3ds/3ds.h index 8df0db6..724712e 100644 --- a/libctru/include/3ds/3ds.h +++ b/libctru/include/3ds/3ds.h @@ -13,4 +13,4 @@ #include <3ds/os.h> #include <3ds/gfx.h> -#endif __3DS_H +#endif