Skip to content

Commit

Permalink
Use shader rules from 3ds_rules
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterMute committed Nov 6, 2023
1 parent 8136d94 commit 5295970
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,38 +223,18 @@ $(OUTPUT).elf : $(OFILES)
@$(bin2o)

#---------------------------------------------------------------------------------
.PRECIOUS : %.t3x
.PRECIOUS : %.t3x %.shbin
#---------------------------------------------------------------------------------
%.t3x.o %_t3x.h : %.t3x
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
# rules for assembling GPU shaders
%.shbin.o %_shbin.h : %.shbin
#---------------------------------------------------------------------------------
define shader-as
$(eval CURBIN := $*.shbin)
$(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d)
echo "$(CURBIN).o: $< $1" > $(DEPSFILE)
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h
picasso -o $(CURBIN) $1
bin2s $(CURBIN) | $(AS) -o $*.shbin.o
endef

%.shbin.o %_shbin.h : %.v.pica %.g.pica
@echo $(notdir $^)
@$(call shader-as,$^)

%.shbin.o %_shbin.h : %.v.pica
@echo $(notdir $<)
@$(call shader-as,$<)

%.shbin.o %_shbin.h : %.shlist
@echo $(notdir $<)
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file)))
$(SILENTMSG) $(notdir $<)
$(bin2o)

#---------------------------------------------------------------------------------
%.t3x %.h : %.t3s
Expand Down

0 comments on commit 5295970

Please sign in to comment.