Binary that renders a triangle using Vulkan, scans the resulting image to a PNG, and makes an occlusion query to determine the number of fragments shaded. To be used in developing Turnip.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ifeq ($(target), cheza)
  2. CXX = /usr/bin/armv7a-cros-linux-gnueabihf-clang++
  3. CC = /usr/bin/armv7a-cros-linux-gnueabihf-clang
  4. SYSROOT = /build/cheza
  5. SSH_DUT = cheza
  6. else ifeq ($(target), atlas)
  7. CXX = /usr/bin/x86_64-cros-linux-gnu-clang++
  8. CC = /usr/bin/x86_64-cros-linux-gnu-clang
  9. SYSROOT = /build/atlas
  10. SSH_DUT = atlas
  11. else ifeq ($(target), local)
  12. CXX = clang++
  13. CC = clang
  14. else
  15. CXX = INVALID
  16. CC = INVALID
  17. endif
  18. SUBDIR = "occlusion-vulkan/"
  19. NAME = occlusion
  20. CFLAGS = -std=c++17 --sysroot="$(SYSROOT)" -Wall
  21. LDFLAGS = -lvulkan -lpng
  22. all: build deploy run
  23. build: check
  24. @echo Building...
  25. @$(CXX) $(CFLAGS) -o ${NAME} ${NAME}.cc $(LDFLAGS)
  26. deploy: check
  27. ifneq ($(target), local)
  28. @echo Deploying to $(SSH_DUT)...
  29. @scp ${NAME}.vert.spv $(SSH_DUT):~/${SUBDIR}${NAME}.vert.spv
  30. @scp ${NAME}.frag.spv $(SSH_DUT):~/${SUBDIR}${NAME}.frag.spv
  31. @scp ${NAME} $(SSH_DUT):~/${SUBDIR}
  32. endif
  33. run: check
  34. ifneq ($(target), local)
  35. @echo Running on $(SSH_DUT)...
  36. @ssh $(SSH_DUT) 'cd ~/${SUBDIR} && ./${NAME}'
  37. @echo Copying artifacts back to local device...
  38. @scp $(SSH_DUT):~/${SUBDIR}${NAME}.png .
  39. else
  40. @echo Running locally...
  41. @./$(NAME)
  42. endif
  43. shaders:
  44. @glslc -c ${NAME}.vert
  45. @glslc -c ${NAME}.frag
  46. clean: check
  47. @rm -f ${NAME} ${NAME}.png ${NAME}.vert.spv ${NAME}.frag.spv
  48. ifneq ($(target), local)
  49. @ssh $(SSH_DUT) 'rm -f ~/${SUBDIR}${NAME} ~/${SUBDIR}${NAME}.png \
  50. ~/${SUBDIR}${NAME}.vert.spv ~/${SUBDIR}${NAME}.frag.spv'
  51. endif
  52. check:
  53. ifeq ($(CXX), INVALID)
  54. $(error $$target must be one of [atlas, cheza, local] )
  55. endif