Geometry shader demo program.
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.

Makefile 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. SUBDIR = geometry
  2. NAME = geometry
  3. CFLAGS = -std=c++17 --sysroot="$(SYSROOT)" -Wall
  4. LDFLAGS = -lvulkan -lpng
  5. TRACE = False
  6. ifeq ($(target),$(filter $(target), cheza cheza-trace))
  7. CXX = /usr/bin/armv7a-cros-linux-gnueabihf-clang++
  8. CC = /usr/bin/armv7a-cros-linux-gnueabihf-clang
  9. SYSROOT = /build/cheza
  10. SSH_DUT = cheza-lab
  11. TARGET = cheza
  12. ifeq ($(target), cheza-trace)
  13. TRACE = True
  14. endif
  15. else ifeq ($(target), atlas)
  16. CXX = /usr/bin/x86_64-cros-linux-gnu-clang++
  17. CC = /usr/bin/x86_64-cros-linux-gnu-clang
  18. SYSROOT = /build/atlas
  19. SSH_DUT = atlas
  20. TARGET = atlas
  21. else ifeq ($(target), android)
  22. ANDROID_ROOT = ~/android
  23. SSH_DUT = android
  24. TARGET = android
  25. else ifeq ($(target), android-trace)
  26. ANDROID_ROOT = ~/android
  27. SSH_DUT = android
  28. TRACE = True
  29. TARGET = android
  30. else ifeq ($(target), local)
  31. CXX = clang++
  32. CC = clang
  33. TARGET = local
  34. else
  35. CXX = INVALID
  36. CC = INVALID
  37. TARGET = INVALID
  38. endif
  39. all: shaders build deploy run
  40. build: check
  41. @echo Building...
  42. ifeq ($(TARGET), android)
  43. @NDK_PROJECT_PATH=. \
  44. NDK_ROOT=${ANDROID_ROOT}/ndk/ \
  45. TARGET_NAME=${NAME} \
  46. COMPILE_ROOT=${ANDROID_ROOT}/compile \
  47. ${ANDROID_ROOT}/ndk/ndk-build NDK_APPLICATION_MK=./Application.mk
  48. else
  49. @$(CXX) $(CFLAGS) -o ${NAME} ${NAME}.cc $(LDFLAGS)
  50. endif
  51. deploy: check
  52. @echo Deploying to $(SSH_DUT)...
  53. ifeq ($(TARGET), android)
  54. @adb push ${NAME}.vert.spv /data/vulkan/${SUBDIR}/${NAME}.vert.spv
  55. @adb push ${NAME}.geom.spv /data/vulkan/${SUBDIR}/${NAME}.geom.spv
  56. @adb push ${NAME}.frag.spv /data/vulkan/${SUBDIR}/${NAME}.frag.spv
  57. @adb push libs/arm64-v8a/${NAME} /data/vulkan/${SUBDIR}/
  58. else ifneq ($(TARGET), local)
  59. @scp ${NAME}.vert.spv $(SSH_DUT):~/${SUBDIR}/${NAME}.vert.spv
  60. @scp ${NAME}.geom.spv $(SSH_DUT):~/${SUBDIR}/${NAME}.geom.spv
  61. @scp ${NAME}.frag.spv $(SSH_DUT):~/${SUBDIR}/${NAME}.frag.spv
  62. @scp ${NAME} $(SSH_DUT):~/${SUBDIR}/
  63. endif
  64. run: check
  65. ifeq ($(TARGET), android)
  66. @echo Running on $(SSH_DUT)...
  67. ifeq ($(TRACE), True)
  68. @adb shell "cd /data/vulkan/${SUBDIR} && LD_PRELOAD=/data/vulkan/libwrap.so ./${NAME}"
  69. @echo Copying artifacts back to local device...
  70. @adb pull /data/vulkan/${SUBDIR}/${NAME}.png .
  71. @adb pull /sdcard/trace.rd .
  72. else
  73. @adb shell "cd /data/vulkan/${SUBDIR} && ./${NAME}"
  74. @echo Copying artifacts back to local device...
  75. @adb pull /data/vulkan/${SUBDIR}/${NAME}.png .
  76. endif
  77. else ifneq ($(TARGET), local)
  78. @echo Running on $(SSH_DUT)...
  79. ifeq ($(TRACE), True)
  80. @ssh -tt $(SSH_DUT) "~/trace.sh 'cd ~/${SUBDIR} && TU_DEBUG=nobin ./${NAME}'"
  81. @echo Copying artifacts back to local device...
  82. @scp $(SSH_DUT):~/${SUBDIR}/${NAME}.png .
  83. @scp $(SSH_DUT):/tmp/trace.rd .
  84. else
  85. @ssh -tt $(SSH_DUT) 'cd ~/${SUBDIR} && ./${NAME}'
  86. @echo Copying artifacts back to local device...
  87. @scp $(SSH_DUT):~/${SUBDIR}/${NAME}.png .
  88. endif
  89. else
  90. @echo Running locally...
  91. @./$(NAME)
  92. endif
  93. shaders:
  94. @glslc -c ${NAME}.vert
  95. @glslc -c ${NAME}.geom
  96. @glslc -c ${NAME}.frag
  97. clean: check
  98. @rm -f ${NAME}
  99. @rm -f ${NAME}.png
  100. @rm -f ${NAME}.vert.spv
  101. @rm -f ${NAME}.geom.spv
  102. @rm -f ${NAME}.frag.spv
  103. @rm -f trace.rd
  104. @rm -rf libs
  105. @rm -rf obj
  106. ifneq ($(TARGET), local)
  107. ifeq ($(TARGET), android)
  108. @adb shell rm /data/vulkan/${SUBDIR}/*
  109. else
  110. @ssh $(SSH_DUT) 'rm -f ~/${SUBDIR}/${NAME} ~/${SUBDIR}/${NAME}.vert.spv \
  111. ~/${SUBDIR}/${NAME}.geom.spv ~/${SUBDIR}/${NAME}.frag.spv \
  112. ~/${SUBDIR}/${NAME}.png'
  113. endif
  114. endif
  115. check:
  116. ifeq ($(TARGET), INVALID)
  117. $(error $$target must be one of [atlas, cheza, cheza-trace, android, android-trace, local])
  118. endif