alphatau 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1362) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +11 -0
  3. data/bin/console +14 -0
  4. data/bin/setup +8 -0
  5. data/ext/alphatau/native/alphatau_native.cpp +141 -0
  6. data/ext/alphatau/native/extconf.rb +18 -0
  7. data/ext/alphatau/native/sdl/Android.mk +110 -0
  8. data/ext/alphatau/native/sdl/BUGS.txt +16 -0
  9. data/ext/alphatau/native/sdl/CMakeLists.txt +1877 -0
  10. data/ext/alphatau/native/sdl/COPYING.txt +20 -0
  11. data/ext/alphatau/native/sdl/CREDITS.txt +53 -0
  12. data/ext/alphatau/native/sdl/INSTALL.txt +40 -0
  13. data/ext/alphatau/native/sdl/Makefile.in +240 -0
  14. data/ext/alphatau/native/sdl/Makefile.minimal +44 -0
  15. data/ext/alphatau/native/sdl/Makefile.pandora +60 -0
  16. data/ext/alphatau/native/sdl/Makefile.psp +95 -0
  17. data/ext/alphatau/native/sdl/Makefile.wiz +80 -0
  18. data/ext/alphatau/native/sdl/README-SDL.txt +13 -0
  19. data/ext/alphatau/native/sdl/README.txt +21 -0
  20. data/ext/alphatau/native/sdl/SDL2.spec.in +118 -0
  21. data/ext/alphatau/native/sdl/SDL2Config.cmake +1 -0
  22. data/ext/alphatau/native/sdl/TODO.txt +10 -0
  23. data/ext/alphatau/native/sdl/VisualC-WinRT/SDL2-WinRT.nuspec +23 -0
  24. data/ext/alphatau/native/sdl/VisualC-WinRT/SDL2-WinRT.targets +38 -0
  25. data/ext/alphatau/native/sdl/VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec +22 -0
  26. data/ext/alphatau/native/sdl/VisualC-WinRT/SDL2main-WinRT-NonXAML.targets +10 -0
  27. data/ext/alphatau/native/sdl/VisualC-WinRT/UWP_VS2015/SDL-UWP.sln +34 -0
  28. data/ext/alphatau/native/sdl/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj +575 -0
  29. data/ext/alphatau/native/sdl/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters +774 -0
  30. data/ext/alphatau/native/sdl/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.sln +28 -0
  31. data/ext/alphatau/native/sdl/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj +466 -0
  32. data/ext/alphatau/native/sdl/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters +735 -0
  33. data/ext/alphatau/native/sdl/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.sln +34 -0
  34. data/ext/alphatau/native/sdl/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj +571 -0
  35. data/ext/alphatau/native/sdl/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters +771 -0
  36. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/Assets/Logo.png +0 -0
  37. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png +0 -0
  38. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png +0 -0
  39. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png +0 -0
  40. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/Package.appxmanifest +42 -0
  41. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj +170 -0
  42. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx +0 -0
  43. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/Assets/Logo.png +0 -0
  44. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/Assets/SmallLogo.png +0 -0
  45. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/Assets/SplashScreen.png +0 -0
  46. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/Assets/StoreLogo.png +0 -0
  47. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/Package.appxmanifest +42 -0
  48. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj +160 -0
  49. data/ext/alphatau/native/sdl/VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx +0 -0
  50. data/ext/alphatau/native/sdl/VisualC.html +146 -0
  51. data/ext/alphatau/native/sdl/VisualC/SDL.sln +291 -0
  52. data/ext/alphatau/native/sdl/VisualC/SDL/SDL.vcxproj +559 -0
  53. data/ext/alphatau/native/sdl/VisualC/SDL/SDL.vcxproj.filters +479 -0
  54. data/ext/alphatau/native/sdl/VisualC/SDLmain/SDLmain.vcxproj +162 -0
  55. data/ext/alphatau/native/sdl/VisualC/SDLtest/SDLtest.vcxproj +177 -0
  56. data/ext/alphatau/native/sdl/VisualC/clean.sh +4 -0
  57. data/ext/alphatau/native/sdl/VisualC/tests/checkkeys/checkkeys.vcxproj +218 -0
  58. data/ext/alphatau/native/sdl/VisualC/tests/controllermap/controllermap.vcxproj +259 -0
  59. data/ext/alphatau/native/sdl/VisualC/tests/loopwave/loopwave.vcxproj +229 -0
  60. data/ext/alphatau/native/sdl/VisualC/tests/testatomic/testatomic.vcxproj +203 -0
  61. data/ext/alphatau/native/sdl/VisualC/tests/testautomation/testautomation.vcxproj +230 -0
  62. data/ext/alphatau/native/sdl/VisualC/tests/testdraw2/testdraw2.vcxproj +209 -0
  63. data/ext/alphatau/native/sdl/VisualC/tests/testfile/testfile.vcxproj +203 -0
  64. data/ext/alphatau/native/sdl/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj +259 -0
  65. data/ext/alphatau/native/sdl/VisualC/tests/testgesture/testgesture.vcxproj +203 -0
  66. data/ext/alphatau/native/sdl/VisualC/tests/testgl2/testgl2.vcxproj +213 -0
  67. data/ext/alphatau/native/sdl/VisualC/tests/testgles2/testgles2.vcxproj +209 -0
  68. data/ext/alphatau/native/sdl/VisualC/tests/testjoystick/testjoystick.vcxproj +203 -0
  69. data/ext/alphatau/native/sdl/VisualC/tests/testoverlay2/testoverlay2.vcxproj +224 -0
  70. data/ext/alphatau/native/sdl/VisualC/tests/testplatform/testplatform.vcxproj +231 -0
  71. data/ext/alphatau/native/sdl/VisualC/tests/testpower/testpower.vcxproj +203 -0
  72. data/ext/alphatau/native/sdl/VisualC/tests/testrendertarget/testrendertarget.vcxproj +247 -0
  73. data/ext/alphatau/native/sdl/VisualC/tests/testrumble/testrumble.vcxproj +203 -0
  74. data/ext/alphatau/native/sdl/VisualC/tests/testscale/testscale.vcxproj +247 -0
  75. data/ext/alphatau/native/sdl/VisualC/tests/testshape/testshape.vcxproj +203 -0
  76. data/ext/alphatau/native/sdl/VisualC/tests/testsprite2/testsprite2.vcxproj +229 -0
  77. data/ext/alphatau/native/sdl/VisualC/tests/testvulkan/testvulkan.vcxproj +203 -0
  78. data/ext/alphatau/native/sdl/VisualC/tests/testyuv/testyuv.vcxproj +233 -0
  79. data/ext/alphatau/native/sdl/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj +216 -0
  80. data/ext/alphatau/native/sdl/VisualC/visualtest/visualtest_VS2012.vcxproj +304 -0
  81. data/ext/alphatau/native/sdl/WhatsNew.txt +401 -0
  82. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/Default.png +0 -0
  83. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj +1299 -0
  84. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/Icon.png +0 -0
  85. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/Info.plist +32 -0
  86. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/README +43 -0
  87. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/bitmapfont/kromasky_16x16.bmp +0 -0
  88. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/bitmapfont/license.txt +258 -0
  89. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/drums/ds_brush_snare.wav +0 -0
  90. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/drums/ds_china.wav +0 -0
  91. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/drums/ds_kick_big_amb.wav +0 -0
  92. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/drums/ds_loose_skin_mute.wav +0 -0
  93. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/icon.bmp +0 -0
  94. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/ship.bmp +0 -0
  95. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/space.bmp +0 -0
  96. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/data/stroke.bmp +0 -0
  97. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/iOS Launch Screen.storyboard +40 -0
  98. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/accelerometer.c +226 -0
  99. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/common.c +56 -0
  100. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/common.h +10 -0
  101. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/fireworks.c +474 -0
  102. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/happy.c +180 -0
  103. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/keyboard.c +301 -0
  104. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/mixer.c +344 -0
  105. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/rectangles.c +92 -0
  106. data/ext/alphatau/native/sdl/Xcode-iOS/Demos/src/touch.c +129 -0
  107. data/ext/alphatau/native/sdl/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj +2047 -0
  108. data/ext/alphatau/native/sdl/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj +422 -0
  109. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/Default-568h@2x.png +0 -0
  110. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/Default.png +0 -0
  111. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/Icon.png +0 -0
  112. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/Info.plist +28 -0
  113. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateIcon.icns +0 -0
  114. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/TemplateInfo.plist +10 -0
  115. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.pbxproj +308 -0
  116. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/___PROJECTNAME___.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  117. data/ext/alphatau/native/sdl/Xcode-iOS/Template/SDL iOS Application/main.c +100 -0
  118. data/ext/alphatau/native/sdl/Xcode-iOS/Test/Info.plist +26 -0
  119. data/ext/alphatau/native/sdl/Xcode-iOS/Test/README +11 -0
  120. data/ext/alphatau/native/sdl/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj +3095 -0
  121. data/ext/alphatau/native/sdl/Xcode/SDL/Info-Framework.plist +28 -0
  122. data/ext/alphatau/native/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj +3384 -0
  123. data/ext/alphatau/native/sdl/Xcode/SDL/pkg-support/SDL.info +15 -0
  124. data/ext/alphatau/native/sdl/Xcode/SDL/pkg-support/resources/License.txt +19 -0
  125. data/ext/alphatau/native/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt +32 -0
  126. data/ext/alphatau/native/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store +0 -0
  127. data/ext/alphatau/native/sdl/Xcode/SDL/pkg-support/sdl_logo.pdf +0 -0
  128. data/ext/alphatau/native/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +4995 -0
  129. data/ext/alphatau/native/sdl/Xcode/SDLTest/TestDropFile-Info.plist +35 -0
  130. data/ext/alphatau/native/sdl/Xcode/XcodeDocSet/Doxyfile +1558 -0
  131. data/ext/alphatau/native/sdl/acinclude/ac_check_define.m4 +14 -0
  132. data/ext/alphatau/native/sdl/acinclude/alsa.m4 +145 -0
  133. data/ext/alphatau/native/sdl/acinclude/ax_check_compiler_flags.m4 +76 -0
  134. data/ext/alphatau/native/sdl/acinclude/ax_gcc_archflag.m4 +215 -0
  135. data/ext/alphatau/native/sdl/acinclude/ax_gcc_x86_cpuid.m4.htm +79 -0
  136. data/ext/alphatau/native/sdl/acinclude/esd.m4 +168 -0
  137. data/ext/alphatau/native/sdl/acinclude/libtool.m4 +7998 -0
  138. data/ext/alphatau/native/sdl/acinclude/ltoptions.m4 +384 -0
  139. data/ext/alphatau/native/sdl/acinclude/ltsugar.m4 +123 -0
  140. data/ext/alphatau/native/sdl/acinclude/ltversion.m4 +23 -0
  141. data/ext/alphatau/native/sdl/acinclude/lt~obsolete.m4 +98 -0
  142. data/ext/alphatau/native/sdl/android-project-ant/AndroidManifest.xml +1 -0
  143. data/ext/alphatau/native/sdl/android-project-ant/ant.properties +17 -0
  144. data/ext/alphatau/native/sdl/android-project-ant/build.properties +17 -0
  145. data/ext/alphatau/native/sdl/android-project-ant/build.xml +93 -0
  146. data/ext/alphatau/native/sdl/android-project-ant/default.properties +11 -0
  147. data/ext/alphatau/native/sdl/android-project-ant/jni/Android.mk +1 -0
  148. data/ext/alphatau/native/sdl/android-project-ant/jni/Application.mk +10 -0
  149. data/ext/alphatau/native/sdl/android-project-ant/jni/src/Android.mk +18 -0
  150. data/ext/alphatau/native/sdl/android-project-ant/jni/src/Android_static.mk +12 -0
  151. data/ext/alphatau/native/sdl/android-project-ant/proguard-project.txt +20 -0
  152. data/ext/alphatau/native/sdl/android-project-ant/project.properties +14 -0
  153. data/ext/alphatau/native/sdl/android-project-ant/res/drawable-hdpi/ic_launcher.png +0 -0
  154. data/ext/alphatau/native/sdl/android-project-ant/res/drawable-mdpi/ic_launcher.png +0 -0
  155. data/ext/alphatau/native/sdl/android-project-ant/res/drawable-xhdpi/ic_launcher.png +0 -0
  156. data/ext/alphatau/native/sdl/android-project-ant/res/drawable-xxhdpi/ic_launcher.png +0 -0
  157. data/ext/alphatau/native/sdl/android-project-ant/res/layout/main.xml +13 -0
  158. data/ext/alphatau/native/sdl/android-project-ant/res/values/strings.xml +4 -0
  159. data/ext/alphatau/native/sdl/android-project-ant/src +1 -0
  160. data/ext/alphatau/native/sdl/android-project/app/build.gradle +69 -0
  161. data/ext/alphatau/native/sdl/android-project/app/jni/Android.mk +1 -0
  162. data/ext/alphatau/native/sdl/android-project/app/jni/Application.mk +9 -0
  163. data/ext/alphatau/native/sdl/android-project/app/jni/src/Android.mk +18 -0
  164. data/ext/alphatau/native/sdl/android-project/app/proguard-rules.pro +17 -0
  165. data/ext/alphatau/native/sdl/android-project/app/src/main/AndroidManifest.xml +77 -0
  166. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/HIDDevice.java +19 -0
  167. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java +640 -0
  168. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java +624 -0
  169. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java +298 -0
  170. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/SDL.java +37 -0
  171. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +2103 -0
  172. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/SDLAudioManager.java +178 -0
  173. data/ext/alphatau/native/sdl/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +812 -0
  174. data/ext/alphatau/native/sdl/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  175. data/ext/alphatau/native/sdl/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  176. data/ext/alphatau/native/sdl/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  177. data/ext/alphatau/native/sdl/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  178. data/ext/alphatau/native/sdl/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  179. data/ext/alphatau/native/sdl/android-project/app/src/main/res/values/colors.xml +6 -0
  180. data/ext/alphatau/native/sdl/android-project/app/src/main/res/values/strings.xml +3 -0
  181. data/ext/alphatau/native/sdl/android-project/app/src/main/res/values/styles.xml +8 -0
  182. data/ext/alphatau/native/sdl/android-project/build.gradle +23 -0
  183. data/ext/alphatau/native/sdl/android-project/gradle.properties +17 -0
  184. data/ext/alphatau/native/sdl/android-project/gradle/wrapper/gradle-wrapper.jar +0 -0
  185. data/ext/alphatau/native/sdl/android-project/gradle/wrapper/gradle-wrapper.properties +6 -0
  186. data/ext/alphatau/native/sdl/android-project/gradlew +160 -0
  187. data/ext/alphatau/native/sdl/android-project/gradlew.bat +90 -0
  188. data/ext/alphatau/native/sdl/android-project/settings.gradle +1 -0
  189. data/ext/alphatau/native/sdl/autogen.sh +23 -0
  190. data/ext/alphatau/native/sdl/build-scripts/androidbuild.sh +100 -0
  191. data/ext/alphatau/native/sdl/build-scripts/androidbuildlibs.sh +74 -0
  192. data/ext/alphatau/native/sdl/build-scripts/checker-buildbot.sh +103 -0
  193. data/ext/alphatau/native/sdl/build-scripts/config.guess +1476 -0
  194. data/ext/alphatau/native/sdl/build-scripts/config.sub +1868 -0
  195. data/ext/alphatau/native/sdl/build-scripts/config.sub.patch +72 -0
  196. data/ext/alphatau/native/sdl/build-scripts/emscripten-buildbot.sh +77 -0
  197. data/ext/alphatau/native/sdl/build-scripts/g++-fat.sh +101 -0
  198. data/ext/alphatau/native/sdl/build-scripts/gcc-fat.sh +102 -0
  199. data/ext/alphatau/native/sdl/build-scripts/install-sh +323 -0
  200. data/ext/alphatau/native/sdl/build-scripts/iosbuild.sh +188 -0
  201. data/ext/alphatau/native/sdl/build-scripts/ltmain.sh +9658 -0
  202. data/ext/alphatau/native/sdl/build-scripts/mkinstalldirs +99 -0
  203. data/ext/alphatau/native/sdl/build-scripts/nacl-buildbot.sh +61 -0
  204. data/ext/alphatau/native/sdl/build-scripts/naclbuild.sh +105 -0
  205. data/ext/alphatau/native/sdl/build-scripts/raspberrypi-buildbot.sh +60 -0
  206. data/ext/alphatau/native/sdl/build-scripts/showrev.sh +5 -0
  207. data/ext/alphatau/native/sdl/build-scripts/strip_fPIC.sh +21 -0
  208. data/ext/alphatau/native/sdl/build-scripts/update-copyright.sh +8 -0
  209. data/ext/alphatau/native/sdl/build-scripts/updaterev.sh +20 -0
  210. data/ext/alphatau/native/sdl/build-scripts/windows-buildbot-zipper.bat +40 -0
  211. data/ext/alphatau/native/sdl/build-scripts/winrtbuild.bat +8 -0
  212. data/ext/alphatau/native/sdl/build-scripts/winrtbuild.ps1 +302 -0
  213. data/ext/alphatau/native/sdl/cmake/macros.cmake +73 -0
  214. data/ext/alphatau/native/sdl/cmake/sdlchecks.cmake +1184 -0
  215. data/ext/alphatau/native/sdl/cmake_uninstall.cmake.in +18 -0
  216. data/ext/alphatau/native/sdl/configure +27540 -0
  217. data/ext/alphatau/native/sdl/configure.in +4236 -0
  218. data/ext/alphatau/native/sdl/debian/changelog +114 -0
  219. data/ext/alphatau/native/sdl/debian/compat +1 -0
  220. data/ext/alphatau/native/sdl/debian/control +76 -0
  221. data/ext/alphatau/native/sdl/debian/copyright +351 -0
  222. data/ext/alphatau/native/sdl/debian/docs +4 -0
  223. data/ext/alphatau/native/sdl/debian/libsdl2-dev.install +8 -0
  224. data/ext/alphatau/native/sdl/debian/libsdl2-dev.manpages +1 -0
  225. data/ext/alphatau/native/sdl/debian/libsdl2.install +1 -0
  226. data/ext/alphatau/native/sdl/debian/rules +41 -0
  227. data/ext/alphatau/native/sdl/debian/sdl2-config.1 +86 -0
  228. data/ext/alphatau/native/sdl/debian/source/format +1 -0
  229. data/ext/alphatau/native/sdl/debian/watch +2 -0
  230. data/ext/alphatau/native/sdl/docs/README-android.md +432 -0
  231. data/ext/alphatau/native/sdl/docs/README-cmake.md +32 -0
  232. data/ext/alphatau/native/sdl/docs/README-directfb.md +107 -0
  233. data/ext/alphatau/native/sdl/docs/README-dynapi.md +130 -0
  234. data/ext/alphatau/native/sdl/docs/README-emscripten.md +35 -0
  235. data/ext/alphatau/native/sdl/docs/README-gesture.md +71 -0
  236. data/ext/alphatau/native/sdl/docs/README-hg.md +22 -0
  237. data/ext/alphatau/native/sdl/docs/README-ios.md +284 -0
  238. data/ext/alphatau/native/sdl/docs/README-linux.md +90 -0
  239. data/ext/alphatau/native/sdl/docs/README-macosx.md +240 -0
  240. data/ext/alphatau/native/sdl/docs/README-nacl.md +103 -0
  241. data/ext/alphatau/native/sdl/docs/README-pandora.md +17 -0
  242. data/ext/alphatau/native/sdl/docs/README-platforms.md +8 -0
  243. data/ext/alphatau/native/sdl/docs/README-porting.md +68 -0
  244. data/ext/alphatau/native/sdl/docs/README-psp.md +19 -0
  245. data/ext/alphatau/native/sdl/docs/README-raspberrypi.md +188 -0
  246. data/ext/alphatau/native/sdl/docs/README-touch.md +86 -0
  247. data/ext/alphatau/native/sdl/docs/README-wince.md +10 -0
  248. data/ext/alphatau/native/sdl/docs/README-windows.md +45 -0
  249. data/ext/alphatau/native/sdl/docs/README-winrt.md +544 -0
  250. data/ext/alphatau/native/sdl/docs/README.md +63 -0
  251. data/ext/alphatau/native/sdl/docs/doxyfile +1560 -0
  252. data/ext/alphatau/native/sdl/include/SDL.h +135 -0
  253. data/ext/alphatau/native/sdl/include/SDL_assert.h +291 -0
  254. data/ext/alphatau/native/sdl/include/SDL_atomic.h +277 -0
  255. data/ext/alphatau/native/sdl/include/SDL_audio.h +825 -0
  256. data/ext/alphatau/native/sdl/include/SDL_bits.h +112 -0
  257. data/ext/alphatau/native/sdl/include/SDL_blendmode.h +120 -0
  258. data/ext/alphatau/native/sdl/include/SDL_clipboard.h +71 -0
  259. data/ext/alphatau/native/sdl/include/SDL_config.h +53 -0
  260. data/ext/alphatau/native/sdl/include/SDL_config.h.cmake +471 -0
  261. data/ext/alphatau/native/sdl/include/SDL_config.h.in +417 -0
  262. data/ext/alphatau/native/sdl/include/SDL_config_android.h +177 -0
  263. data/ext/alphatau/native/sdl/include/SDL_config_iphoneos.h +201 -0
  264. data/ext/alphatau/native/sdl/include/SDL_config_macosx.h +240 -0
  265. data/ext/alphatau/native/sdl/include/SDL_config_minimal.h +85 -0
  266. data/ext/alphatau/native/sdl/include/SDL_config_pandora.h +133 -0
  267. data/ext/alphatau/native/sdl/include/SDL_config_psp.h +164 -0
  268. data/ext/alphatau/native/sdl/include/SDL_config_windows.h +254 -0
  269. data/ext/alphatau/native/sdl/include/SDL_config_winrt.h +235 -0
  270. data/ext/alphatau/native/sdl/include/SDL_config_wiz.h +146 -0
  271. data/ext/alphatau/native/sdl/include/SDL_copying.h +20 -0
  272. data/ext/alphatau/native/sdl/include/SDL_cpuinfo.h +188 -0
  273. data/ext/alphatau/native/sdl/include/SDL_egl.h +1673 -0
  274. data/ext/alphatau/native/sdl/include/SDL_endian.h +260 -0
  275. data/ext/alphatau/native/sdl/include/SDL_error.h +76 -0
  276. data/ext/alphatau/native/sdl/include/SDL_events.h +788 -0
  277. data/ext/alphatau/native/sdl/include/SDL_filesystem.h +136 -0
  278. data/ext/alphatau/native/sdl/include/SDL_gamecontroller.h +383 -0
  279. data/ext/alphatau/native/sdl/include/SDL_gesture.h +87 -0
  280. data/ext/alphatau/native/sdl/include/SDL_haptic.h +1227 -0
  281. data/ext/alphatau/native/sdl/include/SDL_hints.h +1106 -0
  282. data/ext/alphatau/native/sdl/include/SDL_joystick.h +395 -0
  283. data/ext/alphatau/native/sdl/include/SDL_keyboard.h +217 -0
  284. data/ext/alphatau/native/sdl/include/SDL_keycode.h +349 -0
  285. data/ext/alphatau/native/sdl/include/SDL_loadso.h +81 -0
  286. data/ext/alphatau/native/sdl/include/SDL_log.h +211 -0
  287. data/ext/alphatau/native/sdl/include/SDL_main.h +168 -0
  288. data/ext/alphatau/native/sdl/include/SDL_messagebox.h +144 -0
  289. data/ext/alphatau/native/sdl/include/SDL_mouse.h +302 -0
  290. data/ext/alphatau/native/sdl/include/SDL_mutex.h +251 -0
  291. data/ext/alphatau/native/sdl/include/SDL_name.h +33 -0
  292. data/ext/alphatau/native/sdl/include/SDL_opengl.h +2183 -0
  293. data/ext/alphatau/native/sdl/include/SDL_opengl_glext.h +11177 -0
  294. data/ext/alphatau/native/sdl/include/SDL_opengles.h +39 -0
  295. data/ext/alphatau/native/sdl/include/SDL_opengles2.h +52 -0
  296. data/ext/alphatau/native/sdl/include/SDL_opengles2_gl2.h +621 -0
  297. data/ext/alphatau/native/sdl/include/SDL_opengles2_gl2ext.h +2050 -0
  298. data/ext/alphatau/native/sdl/include/SDL_opengles2_gl2platform.h +30 -0
  299. data/ext/alphatau/native/sdl/include/SDL_opengles2_khrplatform.h +282 -0
  300. data/ext/alphatau/native/sdl/include/SDL_pixels.h +470 -0
  301. data/ext/alphatau/native/sdl/include/SDL_platform.h +198 -0
  302. data/ext/alphatau/native/sdl/include/SDL_power.h +75 -0
  303. data/ext/alphatau/native/sdl/include/SDL_quit.h +58 -0
  304. data/ext/alphatau/native/sdl/include/SDL_rect.h +148 -0
  305. data/ext/alphatau/native/sdl/include/SDL_render.h +931 -0
  306. data/ext/alphatau/native/sdl/include/SDL_revision.h +2 -0
  307. data/ext/alphatau/native/sdl/include/SDL_rwops.h +254 -0
  308. data/ext/alphatau/native/sdl/include/SDL_scancode.h +413 -0
  309. data/ext/alphatau/native/sdl/include/SDL_sensor.h +251 -0
  310. data/ext/alphatau/native/sdl/include/SDL_shape.h +144 -0
  311. data/ext/alphatau/native/sdl/include/SDL_stdinc.h +607 -0
  312. data/ext/alphatau/native/sdl/include/SDL_surface.h +546 -0
  313. data/ext/alphatau/native/sdl/include/SDL_system.h +279 -0
  314. data/ext/alphatau/native/sdl/include/SDL_syswm.h +324 -0
  315. data/ext/alphatau/native/sdl/include/SDL_test.h +69 -0
  316. data/ext/alphatau/native/sdl/include/SDL_test_assert.h +105 -0
  317. data/ext/alphatau/native/sdl/include/SDL_test_common.h +188 -0
  318. data/ext/alphatau/native/sdl/include/SDL_test_compare.h +69 -0
  319. data/ext/alphatau/native/sdl/include/SDL_test_crc32.h +124 -0
  320. data/ext/alphatau/native/sdl/include/SDL_test_font.h +81 -0
  321. data/ext/alphatau/native/sdl/include/SDL_test_fuzzer.h +384 -0
  322. data/ext/alphatau/native/sdl/include/SDL_test_harness.h +134 -0
  323. data/ext/alphatau/native/sdl/include/SDL_test_images.h +78 -0
  324. data/ext/alphatau/native/sdl/include/SDL_test_log.h +67 -0
  325. data/ext/alphatau/native/sdl/include/SDL_test_md5.h +129 -0
  326. data/ext/alphatau/native/sdl/include/SDL_test_memory.h +63 -0
  327. data/ext/alphatau/native/sdl/include/SDL_test_random.h +115 -0
  328. data/ext/alphatau/native/sdl/include/SDL_thread.h +309 -0
  329. data/ext/alphatau/native/sdl/include/SDL_timer.h +115 -0
  330. data/ext/alphatau/native/sdl/include/SDL_touch.h +86 -0
  331. data/ext/alphatau/native/sdl/include/SDL_types.h +29 -0
  332. data/ext/alphatau/native/sdl/include/SDL_version.h +162 -0
  333. data/ext/alphatau/native/sdl/include/SDL_video.h +1276 -0
  334. data/ext/alphatau/native/sdl/include/SDL_vulkan.h +278 -0
  335. data/ext/alphatau/native/sdl/include/begin_code.h +167 -0
  336. data/ext/alphatau/native/sdl/include/close_code.h +37 -0
  337. data/ext/alphatau/native/sdl/sdl2-config.cmake.in +11 -0
  338. data/ext/alphatau/native/sdl/sdl2-config.in +60 -0
  339. data/ext/alphatau/native/sdl/sdl2.m4 +234 -0
  340. data/ext/alphatau/native/sdl/sdl2.pc.in +15 -0
  341. data/ext/alphatau/native/sdl/src/SDL.c +514 -0
  342. data/ext/alphatau/native/sdl/src/SDL_assert.c +451 -0
  343. data/ext/alphatau/native/sdl/src/SDL_assert_c.h +24 -0
  344. data/ext/alphatau/native/sdl/src/SDL_dataqueue.c +339 -0
  345. data/ext/alphatau/native/sdl/src/SDL_dataqueue.h +55 -0
  346. data/ext/alphatau/native/sdl/src/SDL_error.c +319 -0
  347. data/ext/alphatau/native/sdl/src/SDL_error_c.h +65 -0
  348. data/ext/alphatau/native/sdl/src/SDL_hints.c +236 -0
  349. data/ext/alphatau/native/sdl/src/SDL_internal.h +52 -0
  350. data/ext/alphatau/native/sdl/src/SDL_log.c +450 -0
  351. data/ext/alphatau/native/sdl/src/atomic/SDL_atomic.c +303 -0
  352. data/ext/alphatau/native/sdl/src/atomic/SDL_spinlock.c +176 -0
  353. data/ext/alphatau/native/sdl/src/audio/SDL_audio.c +1647 -0
  354. data/ext/alphatau/native/sdl/src/audio/SDL_audio_c.h +79 -0
  355. data/ext/alphatau/native/sdl/src/audio/SDL_audiocvt.c +1673 -0
  356. data/ext/alphatau/native/sdl/src/audio/SDL_audiodev.c +124 -0
  357. data/ext/alphatau/native/sdl/src/audio/SDL_audiodev_c.h +38 -0
  358. data/ext/alphatau/native/sdl/src/audio/SDL_audiotypecvt.c +1430 -0
  359. data/ext/alphatau/native/sdl/src/audio/SDL_mixer.c +369 -0
  360. data/ext/alphatau/native/sdl/src/audio/SDL_sysaudio.h +211 -0
  361. data/ext/alphatau/native/sdl/src/audio/SDL_wave.c +694 -0
  362. data/ext/alphatau/native/sdl/src/audio/SDL_wave.h +77 -0
  363. data/ext/alphatau/native/sdl/src/audio/alsa/SDL_alsa_audio.c +990 -0
  364. data/ext/alphatau/native/sdl/src/audio/alsa/SDL_alsa_audio.h +48 -0
  365. data/ext/alphatau/native/sdl/src/audio/android/SDL_androidaudio.c +226 -0
  366. data/ext/alphatau/native/sdl/src/audio/android/SDL_androidaudio.h +42 -0
  367. data/ext/alphatau/native/sdl/src/audio/arts/SDL_artsaudio.c +365 -0
  368. data/ext/alphatau/native/sdl/src/audio/arts/SDL_artsaudio.h +53 -0
  369. data/ext/alphatau/native/sdl/src/audio/coreaudio/SDL_coreaudio.h +66 -0
  370. data/ext/alphatau/native/sdl/src/audio/coreaudio/SDL_coreaudio.m +861 -0
  371. data/ext/alphatau/native/sdl/src/audio/directsound/SDL_directsound.c +604 -0
  372. data/ext/alphatau/native/sdl/src/audio/directsound/SDL_directsound.h +47 -0
  373. data/ext/alphatau/native/sdl/src/audio/disk/SDL_diskaudio.c +207 -0
  374. data/ext/alphatau/native/sdl/src/audio/disk/SDL_diskaudio.h +41 -0
  375. data/ext/alphatau/native/sdl/src/audio/dsp/SDL_dspaudio.c +320 -0
  376. data/ext/alphatau/native/sdl/src/audio/dsp/SDL_dspaudio.h +43 -0
  377. data/ext/alphatau/native/sdl/src/audio/dummy/SDL_dummyaudio.c +65 -0
  378. data/ext/alphatau/native/sdl/src/audio/dummy/SDL_dummyaudio.h +41 -0
  379. data/ext/alphatau/native/sdl/src/audio/emscripten/SDL_emscriptenaudio.c +379 -0
  380. data/ext/alphatau/native/sdl/src/audio/emscripten/SDL_emscriptenaudio.h +38 -0
  381. data/ext/alphatau/native/sdl/src/audio/esd/SDL_esdaudio.c +335 -0
  382. data/ext/alphatau/native/sdl/src/audio/esd/SDL_esdaudio.h +51 -0
  383. data/ext/alphatau/native/sdl/src/audio/fusionsound/SDL_fsaudio.c +328 -0
  384. data/ext/alphatau/native/sdl/src/audio/fusionsound/SDL_fsaudio.h +50 -0
  385. data/ext/alphatau/native/sdl/src/audio/haiku/SDL_haikuaudio.cc +248 -0
  386. data/ext/alphatau/native/sdl/src/audio/haiku/SDL_haikuaudio.h +38 -0
  387. data/ext/alphatau/native/sdl/src/audio/jack/SDL_jackaudio.c +446 -0
  388. data/ext/alphatau/native/sdl/src/audio/jack/SDL_jackaudio.h +41 -0
  389. data/ext/alphatau/native/sdl/src/audio/nacl/SDL_naclaudio.c +165 -0
  390. data/ext/alphatau/native/sdl/src/audio/nacl/SDL_naclaudio.h +43 -0
  391. data/ext/alphatau/native/sdl/src/audio/nas/SDL_nasaudio.c +463 -0
  392. data/ext/alphatau/native/sdl/src/audio/nas/SDL_nasaudio.h +56 -0
  393. data/ext/alphatau/native/sdl/src/audio/netbsd/SDL_netbsdaudio.c +412 -0
  394. data/ext/alphatau/native/sdl/src/audio/netbsd/SDL_netbsdaudio.h +48 -0
  395. data/ext/alphatau/native/sdl/src/audio/paudio/SDL_paudio.c +516 -0
  396. data/ext/alphatau/native/sdl/src/audio/paudio/SDL_paudio.h +48 -0
  397. data/ext/alphatau/native/sdl/src/audio/psp/SDL_pspaudio.c +181 -0
  398. data/ext/alphatau/native/sdl/src/audio/psp/SDL_pspaudio.h +45 -0
  399. data/ext/alphatau/native/sdl/src/audio/pulseaudio/SDL_pulseaudio.c +782 -0
  400. data/ext/alphatau/native/sdl/src/audio/pulseaudio/SDL_pulseaudio.h +52 -0
  401. data/ext/alphatau/native/sdl/src/audio/qsa/SDL_qsa_audio.c +666 -0
  402. data/ext/alphatau/native/sdl/src/audio/qsa/SDL_qsa_audio.h +57 -0
  403. data/ext/alphatau/native/sdl/src/audio/sndio/SDL_sndioaudio.c +382 -0
  404. data/ext/alphatau/native/sdl/src/audio/sndio/SDL_sndioaudio.h +49 -0
  405. data/ext/alphatau/native/sdl/src/audio/sun/SDL_sunaudio.c +419 -0
  406. data/ext/alphatau/native/sdl/src/audio/sun/SDL_sunaudio.h +47 -0
  407. data/ext/alphatau/native/sdl/src/audio/wasapi/SDL_wasapi.c +779 -0
  408. data/ext/alphatau/native/sdl/src/audio/wasapi/SDL_wasapi.h +85 -0
  409. data/ext/alphatau/native/sdl/src/audio/wasapi/SDL_wasapi_win32.c +417 -0
  410. data/ext/alphatau/native/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp +276 -0
  411. data/ext/alphatau/native/sdl/src/audio/winmm/SDL_winmm.c +457 -0
  412. data/ext/alphatau/native/sdl/src/audio/winmm/SDL_winmm.h +45 -0
  413. data/ext/alphatau/native/sdl/src/core/android/SDL_android.c +2285 -0
  414. data/ext/alphatau/native/sdl/src/core/android/SDL_android.h +122 -0
  415. data/ext/alphatau/native/sdl/src/core/android/keyinfotable.h +175 -0
  416. data/ext/alphatau/native/sdl/src/core/linux/SDL_dbus.c +347 -0
  417. data/ext/alphatau/native/sdl/src/core/linux/SDL_dbus.h +97 -0
  418. data/ext/alphatau/native/sdl/src/core/linux/SDL_evdev.c +698 -0
  419. data/ext/alphatau/native/sdl/src/core/linux/SDL_evdev.h +39 -0
  420. data/ext/alphatau/native/sdl/src/core/linux/SDL_evdev_kbd.c +840 -0
  421. data/ext/alphatau/native/sdl/src/core/linux/SDL_evdev_kbd.h +29 -0
  422. data/ext/alphatau/native/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h +284 -0
  423. data/ext/alphatau/native/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h +4763 -0
  424. data/ext/alphatau/native/sdl/src/core/linux/SDL_fcitx.c +373 -0
  425. data/ext/alphatau/native/sdl/src/core/linux/SDL_fcitx.h +40 -0
  426. data/ext/alphatau/native/sdl/src/core/linux/SDL_ibus.c +584 -0
  427. data/ext/alphatau/native/sdl/src/core/linux/SDL_ibus.h +58 -0
  428. data/ext/alphatau/native/sdl/src/core/linux/SDL_ime.c +152 -0
  429. data/ext/alphatau/native/sdl/src/core/linux/SDL_ime.h +40 -0
  430. data/ext/alphatau/native/sdl/src/core/linux/SDL_udev.c +553 -0
  431. data/ext/alphatau/native/sdl/src/core/linux/SDL_udev.h +121 -0
  432. data/ext/alphatau/native/sdl/src/core/unix/SDL_poll.c +87 -0
  433. data/ext/alphatau/native/sdl/src/core/unix/SDL_poll.h +34 -0
  434. data/ext/alphatau/native/sdl/src/core/windows/SDL_directx.h +111 -0
  435. data/ext/alphatau/native/sdl/src/core/windows/SDL_windows.c +233 -0
  436. data/ext/alphatau/native/sdl/src/core/windows/SDL_windows.h +75 -0
  437. data/ext/alphatau/native/sdl/src/core/windows/SDL_xinput.c +139 -0
  438. data/ext/alphatau/native/sdl/src/core/windows/SDL_xinput.h +177 -0
  439. data/ext/alphatau/native/sdl/src/core/winrt/SDL_winrtapp_common.cpp +66 -0
  440. data/ext/alphatau/native/sdl/src/core/winrt/SDL_winrtapp_common.h +31 -0
  441. data/ext/alphatau/native/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp +855 -0
  442. data/ext/alphatau/native/sdl/src/core/winrt/SDL_winrtapp_direct3d.h +92 -0
  443. data/ext/alphatau/native/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp +160 -0
  444. data/ext/alphatau/native/sdl/src/core/winrt/SDL_winrtapp_xaml.h +33 -0
  445. data/ext/alphatau/native/sdl/src/cpuinfo/SDL_cpuinfo.c +855 -0
  446. data/ext/alphatau/native/sdl/src/cpuinfo/SDL_simd.h +88 -0
  447. data/ext/alphatau/native/sdl/src/dynapi/SDL_dynapi.c +331 -0
  448. data/ext/alphatau/native/sdl/src/dynapi/SDL_dynapi.h +67 -0
  449. data/ext/alphatau/native/sdl/src/dynapi/SDL_dynapi_overrides.h +698 -0
  450. data/ext/alphatau/native/sdl/src/dynapi/SDL_dynapi_procs.h +740 -0
  451. data/ext/alphatau/native/sdl/src/dynapi/gendynapi.pl +141 -0
  452. data/ext/alphatau/native/sdl/src/events/SDL_clipboardevents.c +46 -0
  453. data/ext/alphatau/native/sdl/src/events/SDL_clipboardevents_c.h +30 -0
  454. data/ext/alphatau/native/sdl/src/events/SDL_displayevents.c +60 -0
  455. data/ext/alphatau/native/sdl/src/events/SDL_displayevents_c.h +30 -0
  456. data/ext/alphatau/native/sdl/src/events/SDL_dropevents.c +98 -0
  457. data/ext/alphatau/native/sdl/src/events/SDL_dropevents_c.h +32 -0
  458. data/ext/alphatau/native/sdl/src/events/SDL_events.c +976 -0
  459. data/ext/alphatau/native/sdl/src/events/SDL_events_c.h +52 -0
  460. data/ext/alphatau/native/sdl/src/events/SDL_gesture.c +700 -0
  461. data/ext/alphatau/native/sdl/src/events/SDL_gesture_c.h +35 -0
  462. data/ext/alphatau/native/sdl/src/events/SDL_keyboard.c +1033 -0
  463. data/ext/alphatau/native/sdl/src/events/SDL_keyboard_c.h +70 -0
  464. data/ext/alphatau/native/sdl/src/events/SDL_mouse.c +1031 -0
  465. data/ext/alphatau/native/sdl/src/events/SDL_mouse_c.h +141 -0
  466. data/ext/alphatau/native/sdl/src/events/SDL_quit.c +152 -0
  467. data/ext/alphatau/native/sdl/src/events/SDL_sysevents.h +36 -0
  468. data/ext/alphatau/native/sdl/src/events/SDL_touch.c +375 -0
  469. data/ext/alphatau/native/sdl/src/events/SDL_touch_c.h +61 -0
  470. data/ext/alphatau/native/sdl/src/events/SDL_windowevents.c +227 -0
  471. data/ext/alphatau/native/sdl/src/events/SDL_windowevents_c.h +31 -0
  472. data/ext/alphatau/native/sdl/src/events/blank_cursor.h +33 -0
  473. data/ext/alphatau/native/sdl/src/events/default_cursor.h +114 -0
  474. data/ext/alphatau/native/sdl/src/events/scancodes_darwin.h +159 -0
  475. data/ext/alphatau/native/sdl/src/events/scancodes_linux.h +263 -0
  476. data/ext/alphatau/native/sdl/src/events/scancodes_windows.h +55 -0
  477. data/ext/alphatau/native/sdl/src/events/scancodes_xfree86.h +506 -0
  478. data/ext/alphatau/native/sdl/src/file/SDL_rwops.c +867 -0
  479. data/ext/alphatau/native/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h +30 -0
  480. data/ext/alphatau/native/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m +62 -0
  481. data/ext/alphatau/native/sdl/src/filesystem/android/SDL_sysfilesystem.c +62 -0
  482. data/ext/alphatau/native/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m +117 -0
  483. data/ext/alphatau/native/sdl/src/filesystem/dummy/SDL_sysfilesystem.c +47 -0
  484. data/ext/alphatau/native/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c +81 -0
  485. data/ext/alphatau/native/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc +110 -0
  486. data/ext/alphatau/native/sdl/src/filesystem/nacl/SDL_sysfilesystem.c +43 -0
  487. data/ext/alphatau/native/sdl/src/filesystem/unix/SDL_sysfilesystem.c +250 -0
  488. data/ext/alphatau/native/sdl/src/filesystem/windows/SDL_sysfilesystem.c +192 -0
  489. data/ext/alphatau/native/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp +233 -0
  490. data/ext/alphatau/native/sdl/src/haptic/SDL_haptic.c +850 -0
  491. data/ext/alphatau/native/sdl/src/haptic/SDL_haptic_c.h +25 -0
  492. data/ext/alphatau/native/sdl/src/haptic/SDL_syshaptic.h +208 -0
  493. data/ext/alphatau/native/sdl/src/haptic/android/SDL_syshaptic.c +358 -0
  494. data/ext/alphatau/native/sdl/src/haptic/android/SDL_syshaptic_c.h +12 -0
  495. data/ext/alphatau/native/sdl/src/haptic/darwin/SDL_syshaptic.c +1417 -0
  496. data/ext/alphatau/native/sdl/src/haptic/darwin/SDL_syshaptic_c.h +26 -0
  497. data/ext/alphatau/native/sdl/src/haptic/dummy/SDL_syshaptic.c +186 -0
  498. data/ext/alphatau/native/sdl/src/haptic/linux/SDL_syshaptic.c +1165 -0
  499. data/ext/alphatau/native/sdl/src/haptic/windows/SDL_dinputhaptic.c +1305 -0
  500. data/ext/alphatau/native/sdl/src/haptic/windows/SDL_dinputhaptic_c.h +47 -0
  501. data/ext/alphatau/native/sdl/src/haptic/windows/SDL_windowshaptic.c +456 -0
  502. data/ext/alphatau/native/sdl/src/haptic/windows/SDL_windowshaptic_c.h +88 -0
  503. data/ext/alphatau/native/sdl/src/haptic/windows/SDL_xinputhaptic.c +487 -0
  504. data/ext/alphatau/native/sdl/src/haptic/windows/SDL_xinputhaptic_c.h +47 -0
  505. data/ext/alphatau/native/sdl/src/hidapi/AUTHORS.txt +16 -0
  506. data/ext/alphatau/native/sdl/src/hidapi/HACKING.txt +15 -0
  507. data/ext/alphatau/native/sdl/src/hidapi/LICENSE-bsd.txt +26 -0
  508. data/ext/alphatau/native/sdl/src/hidapi/LICENSE-gpl3.txt +674 -0
  509. data/ext/alphatau/native/sdl/src/hidapi/LICENSE-orig.txt +9 -0
  510. data/ext/alphatau/native/sdl/src/hidapi/LICENSE.txt +13 -0
  511. data/ext/alphatau/native/sdl/src/hidapi/Makefile.am +85 -0
  512. data/ext/alphatau/native/sdl/src/hidapi/README.txt +339 -0
  513. data/ext/alphatau/native/sdl/src/hidapi/android/hid.cpp +1079 -0
  514. data/ext/alphatau/native/sdl/src/hidapi/android/jni/Android.mk +16 -0
  515. data/ext/alphatau/native/sdl/src/hidapi/android/jni/Application.mk +2 -0
  516. data/ext/alphatau/native/sdl/src/hidapi/android/project.properties +14 -0
  517. data/ext/alphatau/native/sdl/src/hidapi/bootstrap +2 -0
  518. data/ext/alphatau/native/sdl/src/hidapi/configure.ac +236 -0
  519. data/ext/alphatau/native/sdl/src/hidapi/doxygen/Doxyfile +1630 -0
  520. data/ext/alphatau/native/sdl/src/hidapi/hidapi/hidapi.h +398 -0
  521. data/ext/alphatau/native/sdl/src/hidapi/hidtest/Makefile.am +20 -0
  522. data/ext/alphatau/native/sdl/src/hidapi/hidtest/hidtest.cpp +194 -0
  523. data/ext/alphatau/native/sdl/src/hidapi/ios/Makefile-manual +32 -0
  524. data/ext/alphatau/native/sdl/src/hidapi/ios/Makefile.am +9 -0
  525. data/ext/alphatau/native/sdl/src/hidapi/ios/hid.m +909 -0
  526. data/ext/alphatau/native/sdl/src/hidapi/libusb/Makefile-manual +18 -0
  527. data/ext/alphatau/native/sdl/src/hidapi/libusb/Makefile.am +27 -0
  528. data/ext/alphatau/native/sdl/src/hidapi/libusb/Makefile.freebsd +46 -0
  529. data/ext/alphatau/native/sdl/src/hidapi/libusb/Makefile.linux +49 -0
  530. data/ext/alphatau/native/sdl/src/hidapi/libusb/hid.c +1615 -0
  531. data/ext/alphatau/native/sdl/src/hidapi/libusb/hidusb.cpp +3 -0
  532. data/ext/alphatau/native/sdl/src/hidapi/linux/Makefile-manual +49 -0
  533. data/ext/alphatau/native/sdl/src/hidapi/linux/Makefile.am +10 -0
  534. data/ext/alphatau/native/sdl/src/hidapi/linux/README.txt +59 -0
  535. data/ext/alphatau/native/sdl/src/hidapi/linux/hid.c +893 -0
  536. data/ext/alphatau/native/sdl/src/hidapi/linux/hid.cpp +333 -0
  537. data/ext/alphatau/native/sdl/src/hidapi/linux/hidraw.cpp +3 -0
  538. data/ext/alphatau/native/sdl/src/hidapi/m4/ax_pthread.m4 +309 -0
  539. data/ext/alphatau/native/sdl/src/hidapi/m4/pkg.m4 +157 -0
  540. data/ext/alphatau/native/sdl/src/hidapi/mac/Makefile-manual +32 -0
  541. data/ext/alphatau/native/sdl/src/hidapi/mac/Makefile.am +9 -0
  542. data/ext/alphatau/native/sdl/src/hidapi/mac/hid.c +1186 -0
  543. data/ext/alphatau/native/sdl/src/hidapi/pc/hidapi-hidraw.pc.in +10 -0
  544. data/ext/alphatau/native/sdl/src/hidapi/pc/hidapi-libusb.pc.in +10 -0
  545. data/ext/alphatau/native/sdl/src/hidapi/pc/hidapi.pc.in +10 -0
  546. data/ext/alphatau/native/sdl/src/hidapi/testgui/Makefile-manual +26 -0
  547. data/ext/alphatau/native/sdl/src/hidapi/testgui/Makefile.am +43 -0
  548. data/ext/alphatau/native/sdl/src/hidapi/testgui/Makefile.freebsd +33 -0
  549. data/ext/alphatau/native/sdl/src/hidapi/testgui/Makefile.linux +32 -0
  550. data/ext/alphatau/native/sdl/src/hidapi/testgui/Makefile.mac +46 -0
  551. data/ext/alphatau/native/sdl/src/hidapi/testgui/Makefile.mingw +32 -0
  552. data/ext/alphatau/native/sdl/src/hidapi/testgui/TestGUI.app.in/Contents/Info.plist +28 -0
  553. data/ext/alphatau/native/sdl/src/hidapi/testgui/TestGUI.app.in/Contents/PkgInfo +1 -0
  554. data/ext/alphatau/native/sdl/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/English.lproj/InfoPlist.strings +0 -0
  555. data/ext/alphatau/native/sdl/src/hidapi/testgui/TestGUI.app.in/Contents/Resources/Signal11.icns +0 -0
  556. data/ext/alphatau/native/sdl/src/hidapi/testgui/copy_to_bundle.sh +97 -0
  557. data/ext/alphatau/native/sdl/src/hidapi/testgui/mac_support.cpp +134 -0
  558. data/ext/alphatau/native/sdl/src/hidapi/testgui/mac_support.h +17 -0
  559. data/ext/alphatau/native/sdl/src/hidapi/testgui/mac_support_cocoa.m +94 -0
  560. data/ext/alphatau/native/sdl/src/hidapi/testgui/start.sh +2 -0
  561. data/ext/alphatau/native/sdl/src/hidapi/testgui/test.cpp +532 -0
  562. data/ext/alphatau/native/sdl/src/hidapi/testgui/testgui.sln +20 -0
  563. data/ext/alphatau/native/sdl/src/hidapi/testgui/testgui.vcproj +217 -0
  564. data/ext/alphatau/native/sdl/src/hidapi/udev/99-hid.rules +33 -0
  565. data/ext/alphatau/native/sdl/src/hidapi/windows/Makefile-manual +14 -0
  566. data/ext/alphatau/native/sdl/src/hidapi/windows/Makefile.am +16 -0
  567. data/ext/alphatau/native/sdl/src/hidapi/windows/Makefile.mingw +35 -0
  568. data/ext/alphatau/native/sdl/src/hidapi/windows/ddk_build/hidapi.def +17 -0
  569. data/ext/alphatau/native/sdl/src/hidapi/windows/ddk_build/makefile +49 -0
  570. data/ext/alphatau/native/sdl/src/hidapi/windows/ddk_build/sources +23 -0
  571. data/ext/alphatau/native/sdl/src/hidapi/windows/hid.c +983 -0
  572. data/ext/alphatau/native/sdl/src/hidapi/windows/hidapi.sln +29 -0
  573. data/ext/alphatau/native/sdl/src/hidapi/windows/hidapi.vcproj +201 -0
  574. data/ext/alphatau/native/sdl/src/hidapi/windows/hidtest.vcproj +196 -0
  575. data/ext/alphatau/native/sdl/src/joystick/SDL_gamecontroller.c +2066 -0
  576. data/ext/alphatau/native/sdl/src/joystick/SDL_gamecontrollerdb.h +583 -0
  577. data/ext/alphatau/native/sdl/src/joystick/SDL_joystick.c +1547 -0
  578. data/ext/alphatau/native/sdl/src/joystick/SDL_joystick_c.h +94 -0
  579. data/ext/alphatau/native/sdl/src/joystick/SDL_sysjoystick.h +153 -0
  580. data/ext/alphatau/native/sdl/src/joystick/android/SDL_sysjoystick.c +703 -0
  581. data/ext/alphatau/native/sdl/src/joystick/android/SDL_sysjoystick_c.h +59 -0
  582. data/ext/alphatau/native/sdl/src/joystick/bsd/SDL_sysjoystick.c +701 -0
  583. data/ext/alphatau/native/sdl/src/joystick/controller_type.h +457 -0
  584. data/ext/alphatau/native/sdl/src/joystick/darwin/SDL_sysjoystick.c +1012 -0
  585. data/ext/alphatau/native/sdl/src/joystick/darwin/SDL_sysjoystick_c.h +79 -0
  586. data/ext/alphatau/native/sdl/src/joystick/dummy/SDL_sysjoystick.c +113 -0
  587. data/ext/alphatau/native/sdl/src/joystick/emscripten/SDL_sysjoystick.c +406 -0
  588. data/ext/alphatau/native/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h +52 -0
  589. data/ext/alphatau/native/sdl/src/joystick/haiku/SDL_haikujoystick.cc +272 -0
  590. data/ext/alphatau/native/sdl/src/joystick/hidapi/SDL_hidapi_ps4.c +545 -0
  591. data/ext/alphatau/native/sdl/src/joystick/hidapi/SDL_hidapi_switch.c +905 -0
  592. data/ext/alphatau/native/sdl/src/joystick/hidapi/SDL_hidapi_xbox360.c +461 -0
  593. data/ext/alphatau/native/sdl/src/joystick/hidapi/SDL_hidapi_xboxone.c +318 -0
  594. data/ext/alphatau/native/sdl/src/joystick/hidapi/SDL_hidapijoystick.c +1021 -0
  595. data/ext/alphatau/native/sdl/src/joystick/hidapi/SDL_hidapijoystick_c.h +72 -0
  596. data/ext/alphatau/native/sdl/src/joystick/iphoneos/SDL_sysjoystick.m +727 -0
  597. data/ext/alphatau/native/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h +57 -0
  598. data/ext/alphatau/native/sdl/src/joystick/linux/SDL_sysjoystick.c +1116 -0
  599. data/ext/alphatau/native/sdl/src/joystick/linux/SDL_sysjoystick_c.h +64 -0
  600. data/ext/alphatau/native/sdl/src/joystick/psp/SDL_sysjoystick.c +264 -0
  601. data/ext/alphatau/native/sdl/src/joystick/sort_controllers.py +78 -0
  602. data/ext/alphatau/native/sdl/src/joystick/steam/SDL_steamcontroller.c +52 -0
  603. data/ext/alphatau/native/sdl/src/joystick/steam/SDL_steamcontroller.h +33 -0
  604. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_dinputjoystick.c +1155 -0
  605. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_dinputjoystick_c.h +31 -0
  606. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_mmjoystick.c +452 -0
  607. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_windowsjoystick.c +558 -0
  608. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_windowsjoystick_c.h +95 -0
  609. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_xinputjoystick.c +558 -0
  610. data/ext/alphatau/native/sdl/src/joystick/windows/SDL_xinputjoystick_c.h +34 -0
  611. data/ext/alphatau/native/sdl/src/libm/e_atan2.c +134 -0
  612. data/ext/alphatau/native/sdl/src/libm/e_exp.c +187 -0
  613. data/ext/alphatau/native/sdl/src/libm/e_fmod.c +144 -0
  614. data/ext/alphatau/native/sdl/src/libm/e_log.c +152 -0
  615. data/ext/alphatau/native/sdl/src/libm/e_log10.c +106 -0
  616. data/ext/alphatau/native/sdl/src/libm/e_pow.c +343 -0
  617. data/ext/alphatau/native/sdl/src/libm/e_rem_pio2.c +161 -0
  618. data/ext/alphatau/native/sdl/src/libm/e_sqrt.c +457 -0
  619. data/ext/alphatau/native/sdl/src/libm/k_cos.c +82 -0
  620. data/ext/alphatau/native/sdl/src/libm/k_rem_pio2.c +317 -0
  621. data/ext/alphatau/native/sdl/src/libm/k_sin.c +65 -0
  622. data/ext/alphatau/native/sdl/src/libm/k_tan.c +118 -0
  623. data/ext/alphatau/native/sdl/src/libm/math_libm.h +41 -0
  624. data/ext/alphatau/native/sdl/src/libm/math_private.h +227 -0
  625. data/ext/alphatau/native/sdl/src/libm/s_atan.c +114 -0
  626. data/ext/alphatau/native/sdl/src/libm/s_copysign.c +29 -0
  627. data/ext/alphatau/native/sdl/src/libm/s_cos.c +73 -0
  628. data/ext/alphatau/native/sdl/src/libm/s_fabs.c +29 -0
  629. data/ext/alphatau/native/sdl/src/libm/s_floor.c +71 -0
  630. data/ext/alphatau/native/sdl/src/libm/s_scalbn.c +69 -0
  631. data/ext/alphatau/native/sdl/src/libm/s_sin.c +73 -0
  632. data/ext/alphatau/native/sdl/src/libm/s_tan.c +67 -0
  633. data/ext/alphatau/native/sdl/src/loadso/dlopen/SDL_sysloadso.c +88 -0
  634. data/ext/alphatau/native/sdl/src/loadso/dummy/SDL_sysloadso.c +54 -0
  635. data/ext/alphatau/native/sdl/src/loadso/windows/SDL_sysloadso.c +80 -0
  636. data/ext/alphatau/native/sdl/src/main/android/SDL_android_main.c +7 -0
  637. data/ext/alphatau/native/sdl/src/main/dummy/SDL_dummy_main.c +28 -0
  638. data/ext/alphatau/native/sdl/src/main/haiku/SDL_BApp.h +399 -0
  639. data/ext/alphatau/native/sdl/src/main/haiku/SDL_BeApp.cc +157 -0
  640. data/ext/alphatau/native/sdl/src/main/haiku/SDL_BeApp.h +38 -0
  641. data/ext/alphatau/native/sdl/src/main/nacl/SDL_nacl_main.c +93 -0
  642. data/ext/alphatau/native/sdl/src/main/psp/SDL_psp_main.c +70 -0
  643. data/ext/alphatau/native/sdl/src/main/windows/SDL_windows_main.c +207 -0
  644. data/ext/alphatau/native/sdl/src/main/windows/version.rc +38 -0
  645. data/ext/alphatau/native/sdl/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur +0 -0
  646. data/ext/alphatau/native/sdl/src/main/winrt/SDL2-WinRTResources.rc +3 -0
  647. data/ext/alphatau/native/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp +54 -0
  648. data/ext/alphatau/native/sdl/src/power/SDL_power.c +116 -0
  649. data/ext/alphatau/native/sdl/src/power/SDL_syspower.h +47 -0
  650. data/ext/alphatau/native/sdl/src/power/android/SDL_syspower.c +64 -0
  651. data/ext/alphatau/native/sdl/src/power/emscripten/SDL_syspower.c +62 -0
  652. data/ext/alphatau/native/sdl/src/power/haiku/SDL_syspower.c +128 -0
  653. data/ext/alphatau/native/sdl/src/power/linux/SDL_syspower.c +642 -0
  654. data/ext/alphatau/native/sdl/src/power/macosx/SDL_syspower.c +192 -0
  655. data/ext/alphatau/native/sdl/src/power/psp/SDL_syspower.c +68 -0
  656. data/ext/alphatau/native/sdl/src/power/uikit/SDL_syspower.h +32 -0
  657. data/ext/alphatau/native/sdl/src/power/uikit/SDL_syspower.m +113 -0
  658. data/ext/alphatau/native/sdl/src/power/windows/SDL_syspower.c +76 -0
  659. data/ext/alphatau/native/sdl/src/power/winrt/SDL_syspower.cpp +44 -0
  660. data/ext/alphatau/native/sdl/src/render/SDL_d3dmath.c +136 -0
  661. data/ext/alphatau/native/sdl/src/render/SDL_d3dmath.h +72 -0
  662. data/ext/alphatau/native/sdl/src/render/SDL_render.c +2292 -0
  663. data/ext/alphatau/native/sdl/src/render/SDL_sysrender.h +214 -0
  664. data/ext/alphatau/native/sdl/src/render/SDL_yuv_sw.c +414 -0
  665. data/ext/alphatau/native/sdl/src/render/SDL_yuv_sw_c.h +67 -0
  666. data/ext/alphatau/native/sdl/src/render/direct3d/SDL_render_d3d.c +1813 -0
  667. data/ext/alphatau/native/sdl/src/render/direct3d/SDL_shaders_d3d.c +274 -0
  668. data/ext/alphatau/native/sdl/src/render/direct3d/SDL_shaders_d3d.h +34 -0
  669. data/ext/alphatau/native/sdl/src/render/direct3d11/SDL_render_d3d11.c +2559 -0
  670. data/ext/alphatau/native/sdl/src/render/direct3d11/SDL_render_winrt.cpp +116 -0
  671. data/ext/alphatau/native/sdl/src/render/direct3d11/SDL_render_winrt.h +40 -0
  672. data/ext/alphatau/native/sdl/src/render/direct3d11/SDL_shaders_d3d11.c +1957 -0
  673. data/ext/alphatau/native/sdl/src/render/direct3d11/SDL_shaders_d3d11.h +43 -0
  674. data/ext/alphatau/native/sdl/src/render/metal/SDL_render_metal.m +1428 -0
  675. data/ext/alphatau/native/sdl/src/render/metal/SDL_shaders_metal.metal +109 -0
  676. data/ext/alphatau/native/sdl/src/render/metal/SDL_shaders_metal_ios.h +1899 -0
  677. data/ext/alphatau/native/sdl/src/render/metal/SDL_shaders_metal_osx.h +1903 -0
  678. data/ext/alphatau/native/sdl/src/render/metal/build-metal-shaders.sh +18 -0
  679. data/ext/alphatau/native/sdl/src/render/opengl/SDL_glfuncs.h +478 -0
  680. data/ext/alphatau/native/sdl/src/render/opengl/SDL_render_gl.c +1678 -0
  681. data/ext/alphatau/native/sdl/src/render/opengl/SDL_shaders_gl.c +524 -0
  682. data/ext/alphatau/native/sdl/src/render/opengl/SDL_shaders_gl.h +47 -0
  683. data/ext/alphatau/native/sdl/src/render/opengles/SDL_glesfuncs.h +65 -0
  684. data/ext/alphatau/native/sdl/src/render/opengles/SDL_render_gles.c +1278 -0
  685. data/ext/alphatau/native/sdl/src/render/opengles2/SDL_gles2funcs.h +80 -0
  686. data/ext/alphatau/native/sdl/src/render/opengles2/SDL_render_gles2.c +2256 -0
  687. data/ext/alphatau/native/sdl/src/render/opengles2/SDL_shaders_gles2.c +569 -0
  688. data/ext/alphatau/native/sdl/src/render/opengles2/SDL_shaders_gles2.h +70 -0
  689. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/Makefile +41 -0
  690. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/convert_gl2_h_into_gles2_stubcall_overs_c.sno +181 -0
  691. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/convert_gl2_h_into_gles2_stubcall_overs_h.sno +116 -0
  692. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/convert_gl2_h_into_gles2funcs_h.sno +82 -0
  693. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/convert_gles2funcs_into_gles2_define_overs_h.sno +42 -0
  694. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/gl2.h +686 -0
  695. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/readme.txt +70 -0
  696. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/testgles2.c +725 -0
  697. data/ext/alphatau/native/sdl/src/render/opengles2/build_code_with_snobol/triangle.c +147 -0
  698. data/ext/alphatau/native/sdl/src/render/psp/SDL_render_psp.c +1016 -0
  699. data/ext/alphatau/native/sdl/src/render/software/SDL_blendfillrect.c +336 -0
  700. data/ext/alphatau/native/sdl/src/render/software/SDL_blendfillrect.h +27 -0
  701. data/ext/alphatau/native/sdl/src/render/software/SDL_blendline.c +777 -0
  702. data/ext/alphatau/native/sdl/src/render/software/SDL_blendline.h +27 -0
  703. data/ext/alphatau/native/sdl/src/render/software/SDL_blendpoint.c +341 -0
  704. data/ext/alphatau/native/sdl/src/render/software/SDL_blendpoint.h +27 -0
  705. data/ext/alphatau/native/sdl/src/render/software/SDL_draw.h +576 -0
  706. data/ext/alphatau/native/sdl/src/render/software/SDL_drawline.c +209 -0
  707. data/ext/alphatau/native/sdl/src/render/software/SDL_drawline.h +27 -0
  708. data/ext/alphatau/native/sdl/src/render/software/SDL_drawpoint.c +114 -0
  709. data/ext/alphatau/native/sdl/src/render/software/SDL_drawpoint.h +27 -0
  710. data/ext/alphatau/native/sdl/src/render/software/SDL_render_sw.c +882 -0
  711. data/ext/alphatau/native/sdl/src/render/software/SDL_render_sw_c.h +24 -0
  712. data/ext/alphatau/native/sdl/src/render/software/SDL_rotate.c +530 -0
  713. data/ext/alphatau/native/sdl/src/render/software/SDL_rotate.h +28 -0
  714. data/ext/alphatau/native/sdl/src/sensor/SDL_sensor.c +546 -0
  715. data/ext/alphatau/native/sdl/src/sensor/SDL_sensor_c.h +38 -0
  716. data/ext/alphatau/native/sdl/src/sensor/SDL_syssensor.h +99 -0
  717. data/ext/alphatau/native/sdl/src/sensor/android/SDL_androidsensor.c +211 -0
  718. data/ext/alphatau/native/sdl/src/sensor/android/SDL_androidsensor.h +31 -0
  719. data/ext/alphatau/native/sdl/src/sensor/coremotion/SDL_coremotionsensor.h +30 -0
  720. data/ext/alphatau/native/sdl/src/sensor/coremotion/SDL_coremotionsensor.m +234 -0
  721. data/ext/alphatau/native/sdl/src/sensor/dummy/SDL_dummysensor.c +110 -0
  722. data/ext/alphatau/native/sdl/src/sensor/dummy/SDL_dummysensor.h +23 -0
  723. data/ext/alphatau/native/sdl/src/stdlib/SDL_getenv.c +315 -0
  724. data/ext/alphatau/native/sdl/src/stdlib/SDL_iconv.c +934 -0
  725. data/ext/alphatau/native/sdl/src/stdlib/SDL_malloc.c +5376 -0
  726. data/ext/alphatau/native/sdl/src/stdlib/SDL_qsort.c +534 -0
  727. data/ext/alphatau/native/sdl/src/stdlib/SDL_stdlib.c +1155 -0
  728. data/ext/alphatau/native/sdl/src/stdlib/SDL_string.c +1737 -0
  729. data/ext/alphatau/native/sdl/src/test/SDL_test_assert.c +152 -0
  730. data/ext/alphatau/native/sdl/src/test/SDL_test_common.c +1826 -0
  731. data/ext/alphatau/native/sdl/src/test/SDL_test_compare.c +117 -0
  732. data/ext/alphatau/native/sdl/src/test/SDL_test_crc32.c +166 -0
  733. data/ext/alphatau/native/sdl/src/test/SDL_test_font.c +3250 -0
  734. data/ext/alphatau/native/sdl/src/test/SDL_test_fuzzer.c +534 -0
  735. data/ext/alphatau/native/sdl/src/test/SDL_test_harness.c +683 -0
  736. data/ext/alphatau/native/sdl/src/test/SDL_test_imageBlit.c +1559 -0
  737. data/ext/alphatau/native/sdl/src/test/SDL_test_imageBlitBlend.c +2845 -0
  738. data/ext/alphatau/native/sdl/src/test/SDL_test_imageFace.c +247 -0
  739. data/ext/alphatau/native/sdl/src/test/SDL_test_imagePrimitives.c +514 -0
  740. data/ext/alphatau/native/sdl/src/test/SDL_test_imagePrimitivesBlend.c +696 -0
  741. data/ext/alphatau/native/sdl/src/test/SDL_test_log.c +118 -0
  742. data/ext/alphatau/native/sdl/src/test/SDL_test_md5.c +338 -0
  743. data/ext/alphatau/native/sdl/src/test/SDL_test_memory.c +274 -0
  744. data/ext/alphatau/native/sdl/src/test/SDL_test_random.c +96 -0
  745. data/ext/alphatau/native/sdl/src/thread/SDL_systhread.h +70 -0
  746. data/ext/alphatau/native/sdl/src/thread/SDL_thread.c +503 -0
  747. data/ext/alphatau/native/sdl/src/thread/SDL_thread_c.h +95 -0
  748. data/ext/alphatau/native/sdl/src/thread/generic/SDL_syscond.c +220 -0
  749. data/ext/alphatau/native/sdl/src/thread/generic/SDL_sysmutex.c +165 -0
  750. data/ext/alphatau/native/sdl/src/thread/generic/SDL_sysmutex_c.h +22 -0
  751. data/ext/alphatau/native/sdl/src/thread/generic/SDL_syssem.c +217 -0
  752. data/ext/alphatau/native/sdl/src/thread/generic/SDL_systhread.c +71 -0
  753. data/ext/alphatau/native/sdl/src/thread/generic/SDL_systhread_c.h +26 -0
  754. data/ext/alphatau/native/sdl/src/thread/generic/SDL_systls.c +38 -0
  755. data/ext/alphatau/native/sdl/src/thread/psp/SDL_syscond.c +224 -0
  756. data/ext/alphatau/native/sdl/src/thread/psp/SDL_sysmutex.c +136 -0
  757. data/ext/alphatau/native/sdl/src/thread/psp/SDL_sysmutex_c.h +22 -0
  758. data/ext/alphatau/native/sdl/src/thread/psp/SDL_syssem.c +161 -0
  759. data/ext/alphatau/native/sdl/src/thread/psp/SDL_systhread.c +114 -0
  760. data/ext/alphatau/native/sdl/src/thread/psp/SDL_systhread_c.h +24 -0
  761. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_syscond.c +158 -0
  762. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_sysmutex.c +195 -0
  763. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_sysmutex_c.h +32 -0
  764. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_syssem.c +209 -0
  765. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_systhread.c +324 -0
  766. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_systhread_c.h +27 -0
  767. data/ext/alphatau/native/sdl/src/thread/pthread/SDL_systls.c +70 -0
  768. data/ext/alphatau/native/sdl/src/thread/stdcpp/SDL_syscond.cpp +164 -0
  769. data/ext/alphatau/native/sdl/src/thread/stdcpp/SDL_sysmutex.cpp +111 -0
  770. data/ext/alphatau/native/sdl/src/thread/stdcpp/SDL_sysmutex_c.h +30 -0
  771. data/ext/alphatau/native/sdl/src/thread/stdcpp/SDL_systhread.cpp +168 -0
  772. data/ext/alphatau/native/sdl/src/thread/stdcpp/SDL_systhread_c.h +26 -0
  773. data/ext/alphatau/native/sdl/src/thread/windows/SDL_sysmutex.c +110 -0
  774. data/ext/alphatau/native/sdl/src/thread/windows/SDL_syssem.c +152 -0
  775. data/ext/alphatau/native/sdl/src/thread/windows/SDL_systhread.c +260 -0
  776. data/ext/alphatau/native/sdl/src/thread/windows/SDL_systhread_c.h +32 -0
  777. data/ext/alphatau/native/sdl/src/thread/windows/SDL_systls.c +72 -0
  778. data/ext/alphatau/native/sdl/src/timer/SDL_timer.c +373 -0
  779. data/ext/alphatau/native/sdl/src/timer/SDL_timer_c.h +34 -0
  780. data/ext/alphatau/native/sdl/src/timer/dummy/SDL_systimer.c +75 -0
  781. data/ext/alphatau/native/sdl/src/timer/haiku/SDL_systimer.c +80 -0
  782. data/ext/alphatau/native/sdl/src/timer/psp/SDL_systimer.c +91 -0
  783. data/ext/alphatau/native/sdl/src/timer/unix/SDL_systimer.c +232 -0
  784. data/ext/alphatau/native/sdl/src/timer/windows/SDL_systimer.c +200 -0
  785. data/ext/alphatau/native/sdl/src/video/SDL_RLEaccel.c +1581 -0
  786. data/ext/alphatau/native/sdl/src/video/SDL_RLEaccel_c.h +31 -0
  787. data/ext/alphatau/native/sdl/src/video/SDL_blit.c +296 -0
  788. data/ext/alphatau/native/sdl/src/video/SDL_blit.h +553 -0
  789. data/ext/alphatau/native/sdl/src/video/SDL_blit_0.c +483 -0
  790. data/ext/alphatau/native/sdl/src/video/SDL_blit_1.c +552 -0
  791. data/ext/alphatau/native/sdl/src/video/SDL_blit_A.c +1388 -0
  792. data/ext/alphatau/native/sdl/src/video/SDL_blit_N.c +2647 -0
  793. data/ext/alphatau/native/sdl/src/video/SDL_blit_auto.c +7419 -0
  794. data/ext/alphatau/native/sdl/src/video/SDL_blit_auto.h +30 -0
  795. data/ext/alphatau/native/sdl/src/video/SDL_blit_copy.c +162 -0
  796. data/ext/alphatau/native/sdl/src/video/SDL_blit_copy.h +24 -0
  797. data/ext/alphatau/native/sdl/src/video/SDL_blit_slow.c +164 -0
  798. data/ext/alphatau/native/sdl/src/video/SDL_blit_slow.h +25 -0
  799. data/ext/alphatau/native/sdl/src/video/SDL_bmp.c +702 -0
  800. data/ext/alphatau/native/sdl/src/video/SDL_clipboard.c +90 -0
  801. data/ext/alphatau/native/sdl/src/video/SDL_egl.c +899 -0
  802. data/ext/alphatau/native/sdl/src/video/SDL_egl_c.h +149 -0
  803. data/ext/alphatau/native/sdl/src/video/SDL_fillrect.c +343 -0
  804. data/ext/alphatau/native/sdl/src/video/SDL_pixels.c +1125 -0
  805. data/ext/alphatau/native/sdl/src/video/SDL_pixels_c.h +40 -0
  806. data/ext/alphatau/native/sdl/src/video/SDL_rect.c +531 -0
  807. data/ext/alphatau/native/sdl/src/video/SDL_rect_c.h +25 -0
  808. data/ext/alphatau/native/sdl/src/video/SDL_shape.c +309 -0
  809. data/ext/alphatau/native/sdl/src/video/SDL_shape_internals.h +69 -0
  810. data/ext/alphatau/native/sdl/src/video/SDL_stretch.c +353 -0
  811. data/ext/alphatau/native/sdl/src/video/SDL_surface.c +1232 -0
  812. data/ext/alphatau/native/sdl/src/video/SDL_sysvideo.h +467 -0
  813. data/ext/alphatau/native/sdl/src/video/SDL_video.c +4160 -0
  814. data/ext/alphatau/native/sdl/src/video/SDL_vulkan_internal.h +91 -0
  815. data/ext/alphatau/native/sdl/src/video/SDL_vulkan_utils.c +172 -0
  816. data/ext/alphatau/native/sdl/src/video/SDL_yuv.c +1834 -0
  817. data/ext/alphatau/native/sdl/src/video/SDL_yuv_c.h +30 -0
  818. data/ext/alphatau/native/sdl/src/video/android/SDL_androidclipboard.c +48 -0
  819. data/ext/alphatau/native/sdl/src/video/android/SDL_androidclipboard.h +32 -0
  820. data/ext/alphatau/native/sdl/src/video/android/SDL_androidevents.c +123 -0
  821. data/ext/alphatau/native/sdl/src/video/android/SDL_androidevents.h +27 -0
  822. data/ext/alphatau/native/sdl/src/video/android/SDL_androidgl.c +62 -0
  823. data/ext/alphatau/native/sdl/src/video/android/SDL_androidgl.h +34 -0
  824. data/ext/alphatau/native/sdl/src/video/android/SDL_androidkeyboard.c +391 -0
  825. data/ext/alphatau/native/sdl/src/video/android/SDL_androidkeyboard.h +36 -0
  826. data/ext/alphatau/native/sdl/src/video/android/SDL_androidmessagebox.c +37 -0
  827. data/ext/alphatau/native/sdl/src/video/android/SDL_androidmessagebox.h +29 -0
  828. data/ext/alphatau/native/sdl/src/video/android/SDL_androidmouse.c +266 -0
  829. data/ext/alphatau/native/sdl/src/video/android/SDL_androidmouse.h +33 -0
  830. data/ext/alphatau/native/sdl/src/video/android/SDL_androidtouch.c +151 -0
  831. data/ext/alphatau/native/sdl/src/video/android/SDL_androidtouch.h +29 -0
  832. data/ext/alphatau/native/sdl/src/video/android/SDL_androidvideo.c +259 -0
  833. data/ext/alphatau/native/sdl/src/video/android/SDL_androidvideo.h +51 -0
  834. data/ext/alphatau/native/sdl/src/video/android/SDL_androidvulkan.c +175 -0
  835. data/ext/alphatau/native/sdl/src/video/android/SDL_androidvulkan.h +52 -0
  836. data/ext/alphatau/native/sdl/src/video/android/SDL_androidwindow.c +175 -0
  837. data/ext/alphatau/native/sdl/src/video/android/SDL_androidwindow.h +45 -0
  838. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaclipboard.h +36 -0
  839. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaclipboard.m +103 -0
  840. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaevents.h +32 -0
  841. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaevents.m +483 -0
  842. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoakeyboard.h +36 -0
  843. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoakeyboard.m +720 -0
  844. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamessagebox.h +29 -0
  845. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamessagebox.m +145 -0
  846. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoametalview.h +63 -0
  847. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoametalview.m +134 -0
  848. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamodes.h +46 -0
  849. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamodes.m +490 -0
  850. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamouse.h +52 -0
  851. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamouse.m +477 -0
  852. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamousetap.h +34 -0
  853. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoamousetap.m +279 -0
  854. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaopengl.h +68 -0
  855. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaopengl.m +428 -0
  856. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaopengles.h +49 -0
  857. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoaopengles.m +132 -0
  858. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoashape.h +45 -0
  859. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoashape.m +113 -0
  860. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoavideo.h +118 -0
  861. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoavideo.m +254 -0
  862. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoavulkan.h +55 -0
  863. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoavulkan.m +231 -0
  864. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoawindow.h +155 -0
  865. data/ext/alphatau/native/sdl/src/video/cocoa/SDL_cocoawindow.m +1885 -0
  866. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_WM.c +413 -0
  867. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_WM.h +56 -0
  868. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_dyn.c +117 -0
  869. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_dyn.h +41 -0
  870. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_events.c +748 -0
  871. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_events.h +34 -0
  872. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_modes.c +414 -0
  873. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_modes.h +59 -0
  874. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_mouse.c +389 -0
  875. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_mouse.h +44 -0
  876. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_opengl.c +332 -0
  877. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_opengl.h +64 -0
  878. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_render.c +1335 -0
  879. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_render.h +25 -0
  880. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_shape.c +131 -0
  881. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_shape.h +38 -0
  882. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_video.c +418 -0
  883. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_video.h +170 -0
  884. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_window.c +565 -0
  885. data/ext/alphatau/native/sdl/src/video/directfb/SDL_DirectFB_window.h +82 -0
  886. data/ext/alphatau/native/sdl/src/video/dummy/SDL_nullevents.c +41 -0
  887. data/ext/alphatau/native/sdl/src/video/dummy/SDL_nullevents_c.h +27 -0
  888. data/ext/alphatau/native/sdl/src/video/dummy/SDL_nullframebuffer.c +89 -0
  889. data/ext/alphatau/native/sdl/src/video/dummy/SDL_nullframebuffer_c.h +27 -0
  890. data/ext/alphatau/native/sdl/src/video/dummy/SDL_nullvideo.c +144 -0
  891. data/ext/alphatau/native/sdl/src/video/dummy/SDL_nullvideo.h +30 -0
  892. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenevents.c +716 -0
  893. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenevents.h +40 -0
  894. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c +178 -0
  895. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h +32 -0
  896. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenmouse.c +275 -0
  897. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenmouse.h +42 -0
  898. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenopengles.c +119 -0
  899. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenopengles.h +49 -0
  900. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenvideo.c +354 -0
  901. data/ext/alphatau/native/sdl/src/video/emscripten/SDL_emscriptenvideo.h +58 -0
  902. data/ext/alphatau/native/sdl/src/video/haiku/SDL_BWin.h +679 -0
  903. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bclipboard.cc +95 -0
  904. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bclipboard.h +33 -0
  905. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bevents.cc +41 -0
  906. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bevents.h +39 -0
  907. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bframebuffer.cc +259 -0
  908. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bframebuffer.h +47 -0
  909. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bkeyboard.cc +190 -0
  910. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bkeyboard.h +44 -0
  911. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bmodes.cc +333 -0
  912. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bmodes.h +48 -0
  913. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bopengl.cc +176 -0
  914. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bopengl.h +55 -0
  915. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bvideo.cc +178 -0
  916. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bvideo.h +44 -0
  917. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bwindow.cc +233 -0
  918. data/ext/alphatau/native/sdl/src/video/haiku/SDL_bwindow.h +55 -0
  919. data/ext/alphatau/native/sdl/src/video/khronos/EGL/egl.h +303 -0
  920. data/ext/alphatau/native/sdl/src/video/khronos/EGL/eglext.h +1241 -0
  921. data/ext/alphatau/native/sdl/src/video/khronos/EGL/eglplatform.h +132 -0
  922. data/ext/alphatau/native/sdl/src/video/khronos/GLES2/gl2.h +675 -0
  923. data/ext/alphatau/native/sdl/src/video/khronos/GLES2/gl2ext.h +3505 -0
  924. data/ext/alphatau/native/sdl/src/video/khronos/GLES2/gl2platform.h +38 -0
  925. data/ext/alphatau/native/sdl/src/video/khronos/KHR/khrplatform.h +284 -0
  926. data/ext/alphatau/native/sdl/src/video/khronos/vulkan/vk_platform.h +120 -0
  927. data/ext/alphatau/native/sdl/src/video/khronos/vulkan/vulkan.h +6458 -0
  928. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c +171 -0
  929. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h +53 -0
  930. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c +42 -0
  931. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h +31 -0
  932. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c +501 -0
  933. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h +45 -0
  934. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c +189 -0
  935. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h +48 -0
  936. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h +99 -0
  937. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c +664 -0
  938. data/ext/alphatau/native/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h +124 -0
  939. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirdyn.c +170 -0
  940. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirdyn.h +53 -0
  941. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirevents.c +321 -0
  942. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirevents.h +37 -0
  943. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirframebuffer.c +134 -0
  944. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirframebuffer.h +47 -0
  945. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirmouse.c +292 -0
  946. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirmouse.h +37 -0
  947. data/ext/alphatau/native/sdl/src/video/mir/SDL_miropengl.c +78 -0
  948. data/ext/alphatau/native/sdl/src/video/mir/SDL_miropengl.h +53 -0
  949. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirsym.h +143 -0
  950. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirvideo.c +423 -0
  951. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirvideo.h +49 -0
  952. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirvulkan.c +176 -0
  953. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirvulkan.h +52 -0
  954. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirwindow.c +374 -0
  955. data/ext/alphatau/native/sdl/src/video/mir/SDL_mirwindow.h +93 -0
  956. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclevents.c +438 -0
  957. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclevents_c.h +30 -0
  958. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclglue.c +24 -0
  959. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclopengles.c +174 -0
  960. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclopengles.h +38 -0
  961. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclvideo.c +183 -0
  962. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclvideo.h +67 -0
  963. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclwindow.c +79 -0
  964. data/ext/alphatau/native/sdl/src/video/nacl/SDL_naclwindow.h +32 -0
  965. data/ext/alphatau/native/sdl/src/video/pandora/SDL_pandora.c +838 -0
  966. data/ext/alphatau/native/sdl/src/video/pandora/SDL_pandora.h +101 -0
  967. data/ext/alphatau/native/sdl/src/video/pandora/SDL_pandora_events.c +38 -0
  968. data/ext/alphatau/native/sdl/src/video/pandora/SDL_pandora_events.h +25 -0
  969. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspevents.c +290 -0
  970. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspevents_c.h +31 -0
  971. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspgl.c +210 -0
  972. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspgl_c.h +54 -0
  973. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspmouse.c +41 -0
  974. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspmouse_c.h +24 -0
  975. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspvideo.c +333 -0
  976. data/ext/alphatau/native/sdl/src/video/psp/SDL_pspvideo.h +102 -0
  977. data/ext/alphatau/native/sdl/src/video/qnx/gl.c +285 -0
  978. data/ext/alphatau/native/sdl/src/video/qnx/keyboard.c +133 -0
  979. data/ext/alphatau/native/sdl/src/video/qnx/sdl_qnx.h +48 -0
  980. data/ext/alphatau/native/sdl/src/video/qnx/video.c +364 -0
  981. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpievents.c +45 -0
  982. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpievents_c.h +31 -0
  983. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpimouse.c +386 -0
  984. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpimouse.h +43 -0
  985. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpiopengles.c +71 -0
  986. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpiopengles.h +49 -0
  987. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpivideo.c +442 -0
  988. data/ext/alphatau/native/sdl/src/video/raspberry/SDL_rpivideo.h +104 -0
  989. data/ext/alphatau/native/sdl/src/video/sdlgenblit.pl +535 -0
  990. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitappdelegate.h +47 -0
  991. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitappdelegate.m +516 -0
  992. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitclipboard.h +35 -0
  993. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitclipboard.m +111 -0
  994. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitevents.h +30 -0
  995. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitevents.m +73 -0
  996. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitmessagebox.h +31 -0
  997. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitmessagebox.m +208 -0
  998. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitmetalview.h +58 -0
  999. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitmetalview.m +131 -0
  1000. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitmodes.h +54 -0
  1001. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitmodes.m +378 -0
  1002. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitopengles.h +40 -0
  1003. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitopengles.m +250 -0
  1004. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitopenglview.h +60 -0
  1005. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitopenglview.m +384 -0
  1006. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitvideo.h +46 -0
  1007. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitvideo.m +249 -0
  1008. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitview.h +41 -0
  1009. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitview.m +328 -0
  1010. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitviewcontroller.h +91 -0
  1011. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitviewcontroller.m +532 -0
  1012. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitvulkan.h +54 -0
  1013. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitvulkan.m +222 -0
  1014. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitwindow.h +56 -0
  1015. data/ext/alphatau/native/sdl/src/video/uikit/SDL_uikitwindow.m +465 -0
  1016. data/ext/alphatau/native/sdl/src/video/uikit/keyinfotable.h +174 -0
  1017. data/ext/alphatau/native/sdl/src/video/vivante/SDL_vivanteopengles.c +47 -0
  1018. data/ext/alphatau/native/sdl/src/video/vivante/SDL_vivanteopengles.h +48 -0
  1019. data/ext/alphatau/native/sdl/src/video/vivante/SDL_vivanteplatform.c +54 -0
  1020. data/ext/alphatau/native/sdl/src/video/vivante/SDL_vivanteplatform.h +47 -0
  1021. data/ext/alphatau/native/sdl/src/video/vivante/SDL_vivantevideo.c +409 -0
  1022. data/ext/alphatau/native/sdl/src/video/vivante/SDL_vivantevideo.h +91 -0
  1023. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandclipboard.c +123 -0
  1024. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandclipboard.h +32 -0
  1025. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylanddatamanager.c +468 -0
  1026. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylanddatamanager.h +103 -0
  1027. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylanddyn.c +178 -0
  1028. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylanddyn.h +107 -0
  1029. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandevents.c +1134 -0
  1030. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandevents_c.h +51 -0
  1031. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandmouse.c +396 -0
  1032. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandmouse.h +31 -0
  1033. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandopengles.c +93 -0
  1034. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandopengles.h +49 -0
  1035. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandsym.h +127 -0
  1036. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandtouch.c +265 -0
  1037. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandtouch.h +352 -0
  1038. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandvideo.c +517 -0
  1039. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandvideo.h +85 -0
  1040. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandvulkan.c +176 -0
  1041. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandvulkan.h +52 -0
  1042. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandwindow.c +684 -0
  1043. data/ext/alphatau/native/sdl/src/video/wayland/SDL_waylandwindow.h +88 -0
  1044. data/ext/alphatau/native/sdl/src/video/windows/SDL_msctf.h +242 -0
  1045. data/ext/alphatau/native/sdl/src/video/windows/SDL_vkeys.h +76 -0
  1046. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsclipboard.c +160 -0
  1047. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsclipboard.h +36 -0
  1048. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsevents.c +1229 -0
  1049. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsevents.h +36 -0
  1050. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsframebuffer.c +127 -0
  1051. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsframebuffer.h +27 -0
  1052. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowskeyboard.c +1579 -0
  1053. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowskeyboard.h +40 -0
  1054. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsmessagebox.c +905 -0
  1055. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsmessagebox.h +29 -0
  1056. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsmodes.c +407 -0
  1057. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsmodes.h +47 -0
  1058. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsmouse.c +322 -0
  1059. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsmouse.h +33 -0
  1060. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsopengl.c +895 -0
  1061. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsopengl.h +142 -0
  1062. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsopengles.c +131 -0
  1063. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsopengles.h +49 -0
  1064. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsshape.c +110 -0
  1065. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsshape.h +40 -0
  1066. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowstaskdialog.h +156 -0
  1067. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsvideo.c +442 -0
  1068. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsvideo.h +199 -0
  1069. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsvulkan.c +176 -0
  1070. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowsvulkan.h +52 -0
  1071. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowswindow.c +992 -0
  1072. data/ext/alphatau/native/sdl/src/video/windows/SDL_windowswindow.h +86 -0
  1073. data/ext/alphatau/native/sdl/src/video/windows/wmmsg.h +1052 -0
  1074. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtevents.cpp +154 -0
  1075. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtevents_c.h +82 -0
  1076. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtgamebar.cpp +196 -0
  1077. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h +35 -0
  1078. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtkeyboard.cpp +430 -0
  1079. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtmessagebox.cpp +112 -0
  1080. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtmessagebox.h +29 -0
  1081. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtmouse.cpp +224 -0
  1082. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtmouse_c.h +40 -0
  1083. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtopengles.cpp +203 -0
  1084. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtopengles.h +70 -0
  1085. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtpointerinput.cpp +415 -0
  1086. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtvideo.cpp +842 -0
  1087. data/ext/alphatau/native/sdl/src/video/winrt/SDL_winrtvideo_cpp.h +106 -0
  1088. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11clipboard.c +199 -0
  1089. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11clipboard.h +33 -0
  1090. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11dyn.c +212 -0
  1091. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11dyn.h +111 -0
  1092. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11events.c +1500 -0
  1093. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11events.h +31 -0
  1094. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11framebuffer.c +257 -0
  1095. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11framebuffer.h +31 -0
  1096. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11keyboard.c +543 -0
  1097. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11keyboard.h +36 -0
  1098. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11messagebox.c +853 -0
  1099. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11messagebox.h +28 -0
  1100. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11modes.c +1112 -0
  1101. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11modes.h +85 -0
  1102. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11mouse.c +448 -0
  1103. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11mouse.h +31 -0
  1104. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11opengl.c +946 -0
  1105. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11opengl.h +84 -0
  1106. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11opengles.c +109 -0
  1107. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11opengles.h +56 -0
  1108. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11shape.c +115 -0
  1109. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11shape.h +39 -0
  1110. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11sym.h +337 -0
  1111. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11touch.c +54 -0
  1112. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11touch.h +32 -0
  1113. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11video.c +497 -0
  1114. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11video.h +156 -0
  1115. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11vulkan.c +243 -0
  1116. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11vulkan.h +48 -0
  1117. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11window.c +1619 -0
  1118. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11window.h +111 -0
  1119. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11xinput2.c +313 -0
  1120. data/ext/alphatau/native/sdl/src/video/x11/SDL_x11xinput2.h +42 -0
  1121. data/ext/alphatau/native/sdl/src/video/x11/edid-parse.c +754 -0
  1122. data/ext/alphatau/native/sdl/src/video/x11/edid.h +167 -0
  1123. data/ext/alphatau/native/sdl/src/video/x11/imKStoUCS.c +350 -0
  1124. data/ext/alphatau/native/sdl/src/video/x11/imKStoUCS.h +32 -0
  1125. data/ext/alphatau/native/sdl/src/video/yuv2rgb/LICENSE +27 -0
  1126. data/ext/alphatau/native/sdl/src/video/yuv2rgb/README.md +63 -0
  1127. data/ext/alphatau/native/sdl/src/video/yuv2rgb/yuv_rgb.c +687 -0
  1128. data/ext/alphatau/native/sdl/src/video/yuv2rgb/yuv_rgb.h +381 -0
  1129. data/ext/alphatau/native/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h +498 -0
  1130. data/ext/alphatau/native/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h +228 -0
  1131. data/ext/alphatau/native/sdl/test/CMakeLists.txt +122 -0
  1132. data/ext/alphatau/native/sdl/test/COPYING +8 -0
  1133. data/ext/alphatau/native/sdl/test/Makefile.in +328 -0
  1134. data/ext/alphatau/native/sdl/test/README +47 -0
  1135. data/ext/alphatau/native/sdl/test/acinclude.m4 +359 -0
  1136. data/ext/alphatau/native/sdl/test/aclocal.m4 +359 -0
  1137. data/ext/alphatau/native/sdl/test/autogen.sh +12 -0
  1138. data/ext/alphatau/native/sdl/test/axis.bmp +0 -0
  1139. data/ext/alphatau/native/sdl/test/button.bmp +0 -0
  1140. data/ext/alphatau/native/sdl/test/checkkeys.c +248 -0
  1141. data/ext/alphatau/native/sdl/test/configure +5124 -0
  1142. data/ext/alphatau/native/sdl/test/configure.in +191 -0
  1143. data/ext/alphatau/native/sdl/test/controllermap.bmp +0 -0
  1144. data/ext/alphatau/native/sdl/test/controllermap.c +781 -0
  1145. data/ext/alphatau/native/sdl/test/emscripten/joystick-pre.js +25 -0
  1146. data/ext/alphatau/native/sdl/test/gcc-fat.sh +110 -0
  1147. data/ext/alphatau/native/sdl/test/icon.bmp +0 -0
  1148. data/ext/alphatau/native/sdl/test/loopwave.c +179 -0
  1149. data/ext/alphatau/native/sdl/test/loopwavequeue.c +149 -0
  1150. data/ext/alphatau/native/sdl/test/moose.dat +0 -0
  1151. data/ext/alphatau/native/sdl/test/nacl/Makefile +63 -0
  1152. data/ext/alphatau/native/sdl/test/nacl/background.js +40 -0
  1153. data/ext/alphatau/native/sdl/test/nacl/common.js +474 -0
  1154. data/ext/alphatau/native/sdl/test/nacl/index.html +21 -0
  1155. data/ext/alphatau/native/sdl/test/nacl/manifest.json +22 -0
  1156. data/ext/alphatau/native/sdl/test/picture.xbm +14 -0
  1157. data/ext/alphatau/native/sdl/test/relative_mode.markdown +58 -0
  1158. data/ext/alphatau/native/sdl/test/sample.bmp +0 -0
  1159. data/ext/alphatau/native/sdl/test/sample.wav +0 -0
  1160. data/ext/alphatau/native/sdl/test/shapes/p01_shape24.bmp +0 -0
  1161. data/ext/alphatau/native/sdl/test/shapes/p01_shape32alpha.bmp +0 -0
  1162. data/ext/alphatau/native/sdl/test/shapes/p01_shape8.bmp +0 -0
  1163. data/ext/alphatau/native/sdl/test/shapes/p02_shape24.bmp +0 -0
  1164. data/ext/alphatau/native/sdl/test/shapes/p02_shape32alpha.bmp +0 -0
  1165. data/ext/alphatau/native/sdl/test/shapes/p02_shape8.bmp +0 -0
  1166. data/ext/alphatau/native/sdl/test/shapes/p03_shape24.bmp +0 -0
  1167. data/ext/alphatau/native/sdl/test/shapes/p03_shape8.bmp +0 -0
  1168. data/ext/alphatau/native/sdl/test/shapes/p04_shape1.bmp +0 -0
  1169. data/ext/alphatau/native/sdl/test/shapes/p04_shape24.bmp +0 -0
  1170. data/ext/alphatau/native/sdl/test/shapes/p04_shape32alpha.bmp +0 -0
  1171. data/ext/alphatau/native/sdl/test/shapes/p04_shape8.bmp +0 -0
  1172. data/ext/alphatau/native/sdl/test/shapes/p05_shape8.bmp +0 -0
  1173. data/ext/alphatau/native/sdl/test/shapes/p06_shape1alpha.bmp +0 -0
  1174. data/ext/alphatau/native/sdl/test/shapes/p06_shape24.bmp +0 -0
  1175. data/ext/alphatau/native/sdl/test/shapes/p06_shape32alpha.bmp +0 -0
  1176. data/ext/alphatau/native/sdl/test/shapes/p06_shape8.bmp +0 -0
  1177. data/ext/alphatau/native/sdl/test/shapes/p07_shape24.bmp +0 -0
  1178. data/ext/alphatau/native/sdl/test/shapes/p07_shape32alpha.bmp +0 -0
  1179. data/ext/alphatau/native/sdl/test/shapes/p07_shape8.bmp +0 -0
  1180. data/ext/alphatau/native/sdl/test/shapes/p08_shape24.bmp +0 -0
  1181. data/ext/alphatau/native/sdl/test/shapes/p08_shape32alpha.bmp +0 -0
  1182. data/ext/alphatau/native/sdl/test/shapes/p08_shape8.bmp +0 -0
  1183. data/ext/alphatau/native/sdl/test/shapes/p09_shape24.bmp +0 -0
  1184. data/ext/alphatau/native/sdl/test/shapes/p09_shape32alpha.bmp +0 -0
  1185. data/ext/alphatau/native/sdl/test/shapes/p09_shape8.bmp +0 -0
  1186. data/ext/alphatau/native/sdl/test/shapes/p10_shape1.bmp +0 -0
  1187. data/ext/alphatau/native/sdl/test/shapes/p10_shape24.bmp +0 -0
  1188. data/ext/alphatau/native/sdl/test/shapes/p10_shape32alpha.bmp +0 -0
  1189. data/ext/alphatau/native/sdl/test/shapes/p10_shape8.bmp +0 -0
  1190. data/ext/alphatau/native/sdl/test/shapes/p11_shape24.bmp +0 -0
  1191. data/ext/alphatau/native/sdl/test/shapes/p11_shape32alpha.bmp +0 -0
  1192. data/ext/alphatau/native/sdl/test/shapes/p11_shape8.bmp +0 -0
  1193. data/ext/alphatau/native/sdl/test/shapes/p12_shape24.bmp +0 -0
  1194. data/ext/alphatau/native/sdl/test/shapes/p12_shape8.bmp +0 -0
  1195. data/ext/alphatau/native/sdl/test/shapes/p13_shape24.bmp +0 -0
  1196. data/ext/alphatau/native/sdl/test/shapes/p13_shape32alpha.bmp +0 -0
  1197. data/ext/alphatau/native/sdl/test/shapes/p13_shape8.bmp +0 -0
  1198. data/ext/alphatau/native/sdl/test/shapes/p14_shape24.bmp +0 -0
  1199. data/ext/alphatau/native/sdl/test/shapes/p14_shape8.bmp +0 -0
  1200. data/ext/alphatau/native/sdl/test/shapes/p15_shape24.bmp +0 -0
  1201. data/ext/alphatau/native/sdl/test/shapes/p15_shape32alpha.bmp +0 -0
  1202. data/ext/alphatau/native/sdl/test/shapes/p15_shape8.bmp +0 -0
  1203. data/ext/alphatau/native/sdl/test/shapes/p16_shape1.bmp +0 -0
  1204. data/ext/alphatau/native/sdl/test/shapes/p16_shape24.bmp +0 -0
  1205. data/ext/alphatau/native/sdl/test/shapes/p16_shape8.bmp +0 -0
  1206. data/ext/alphatau/native/sdl/test/shapes/trollface_24.bmp +0 -0
  1207. data/ext/alphatau/native/sdl/test/shapes/trollface_32alpha.bmp +0 -0
  1208. data/ext/alphatau/native/sdl/test/testatomic.c +727 -0
  1209. data/ext/alphatau/native/sdl/test/testaudiocapture.c +165 -0
  1210. data/ext/alphatau/native/sdl/test/testaudiohotplug.c +203 -0
  1211. data/ext/alphatau/native/sdl/test/testaudioinfo.c +74 -0
  1212. data/ext/alphatau/native/sdl/test/testautomation.c +124 -0
  1213. data/ext/alphatau/native/sdl/test/testautomation_audio.c +1038 -0
  1214. data/ext/alphatau/native/sdl/test/testautomation_clipboard.c +184 -0
  1215. data/ext/alphatau/native/sdl/test/testautomation_events.c +201 -0
  1216. data/ext/alphatau/native/sdl/test/testautomation_hints.c +168 -0
  1217. data/ext/alphatau/native/sdl/test/testautomation_keyboard.c +713 -0
  1218. data/ext/alphatau/native/sdl/test/testautomation_main.c +157 -0
  1219. data/ext/alphatau/native/sdl/test/testautomation_mouse.c +606 -0
  1220. data/ext/alphatau/native/sdl/test/testautomation_pixels.c +529 -0
  1221. data/ext/alphatau/native/sdl/test/testautomation_platform.c +584 -0
  1222. data/ext/alphatau/native/sdl/test/testautomation_rect.c +1696 -0
  1223. data/ext/alphatau/native/sdl/test/testautomation_render.c +1099 -0
  1224. data/ext/alphatau/native/sdl/test/testautomation_rwops.c +748 -0
  1225. data/ext/alphatau/native/sdl/test/testautomation_sdltest.c +1319 -0
  1226. data/ext/alphatau/native/sdl/test/testautomation_stdlib.c +319 -0
  1227. data/ext/alphatau/native/sdl/test/testautomation_suites.h +54 -0
  1228. data/ext/alphatau/native/sdl/test/testautomation_surface.c +647 -0
  1229. data/ext/alphatau/native/sdl/test/testautomation_syswm.c +61 -0
  1230. data/ext/alphatau/native/sdl/test/testautomation_timer.c +201 -0
  1231. data/ext/alphatau/native/sdl/test/testautomation_video.c +1811 -0
  1232. data/ext/alphatau/native/sdl/test/testbounds.c +40 -0
  1233. data/ext/alphatau/native/sdl/test/testcustomcursor.c +259 -0
  1234. data/ext/alphatau/native/sdl/test/testdisplayinfo.c +96 -0
  1235. data/ext/alphatau/native/sdl/test/testdraw2.c +305 -0
  1236. data/ext/alphatau/native/sdl/test/testdrawchessboard.c +147 -0
  1237. data/ext/alphatau/native/sdl/test/testdropfile.c +98 -0
  1238. data/ext/alphatau/native/sdl/test/testerror.c +76 -0
  1239. data/ext/alphatau/native/sdl/test/testfile.c +283 -0
  1240. data/ext/alphatau/native/sdl/test/testfilesystem.c +60 -0
  1241. data/ext/alphatau/native/sdl/test/testgamecontroller.c +375 -0
  1242. data/ext/alphatau/native/sdl/test/testgesture.c +309 -0
  1243. data/ext/alphatau/native/sdl/test/testgl2.c +416 -0
  1244. data/ext/alphatau/native/sdl/test/testgles.c +355 -0
  1245. data/ext/alphatau/native/sdl/test/testgles2.c +732 -0
  1246. data/ext/alphatau/native/sdl/test/testhaptic.c +369 -0
  1247. data/ext/alphatau/native/sdl/test/testhittesting.c +134 -0
  1248. data/ext/alphatau/native/sdl/test/testhotplug.c +162 -0
  1249. data/ext/alphatau/native/sdl/test/testiconv.c +88 -0
  1250. data/ext/alphatau/native/sdl/test/testime.c +801 -0
  1251. data/ext/alphatau/native/sdl/test/testintersections.c +363 -0
  1252. data/ext/alphatau/native/sdl/test/testjoystick.c +387 -0
  1253. data/ext/alphatau/native/sdl/test/testkeys.c +40 -0
  1254. data/ext/alphatau/native/sdl/test/testloadso.c +82 -0
  1255. data/ext/alphatau/native/sdl/test/testlock.c +128 -0
  1256. data/ext/alphatau/native/sdl/test/testmessage.c +193 -0
  1257. data/ext/alphatau/native/sdl/test/testmultiaudio.c +199 -0
  1258. data/ext/alphatau/native/sdl/test/testnative.c +237 -0
  1259. data/ext/alphatau/native/sdl/test/testnative.h +46 -0
  1260. data/ext/alphatau/native/sdl/test/testnativecocoa.m +51 -0
  1261. data/ext/alphatau/native/sdl/test/testnativew32.c +86 -0
  1262. data/ext/alphatau/native/sdl/test/testnativex11.c +53 -0
  1263. data/ext/alphatau/native/sdl/test/testoverlay2.c +408 -0
  1264. data/ext/alphatau/native/sdl/test/testplatform.c +442 -0
  1265. data/ext/alphatau/native/sdl/test/testpower.c +80 -0
  1266. data/ext/alphatau/native/sdl/test/testqsort.c +108 -0
  1267. data/ext/alphatau/native/sdl/test/testrelative.c +126 -0
  1268. data/ext/alphatau/native/sdl/test/testrendercopyex.c +233 -0
  1269. data/ext/alphatau/native/sdl/test/testrendertarget.c +335 -0
  1270. data/ext/alphatau/native/sdl/test/testresample.c +120 -0
  1271. data/ext/alphatau/native/sdl/test/testrumble.c +153 -0
  1272. data/ext/alphatau/native/sdl/test/testscale.c +224 -0
  1273. data/ext/alphatau/native/sdl/test/testsem.c +130 -0
  1274. data/ext/alphatau/native/sdl/test/testsensor.c +117 -0
  1275. data/ext/alphatau/native/sdl/test/testshader.c +500 -0
  1276. data/ext/alphatau/native/sdl/test/testshape.c +200 -0
  1277. data/ext/alphatau/native/sdl/test/testsprite2.c +409 -0
  1278. data/ext/alphatau/native/sdl/test/testspriteminimal.c +194 -0
  1279. data/ext/alphatau/native/sdl/test/teststreaming.c +190 -0
  1280. data/ext/alphatau/native/sdl/test/testthread.c +130 -0
  1281. data/ext/alphatau/native/sdl/test/testtimer.c +122 -0
  1282. data/ext/alphatau/native/sdl/test/testver.c +47 -0
  1283. data/ext/alphatau/native/sdl/test/testviewport.c +217 -0
  1284. data/ext/alphatau/native/sdl/test/testvulkan.c +1201 -0
  1285. data/ext/alphatau/native/sdl/test/testwm2.c +174 -0
  1286. data/ext/alphatau/native/sdl/test/testyuv.bmp +0 -0
  1287. data/ext/alphatau/native/sdl/test/testyuv.c +455 -0
  1288. data/ext/alphatau/native/sdl/test/testyuv_cvt.c +300 -0
  1289. data/ext/alphatau/native/sdl/test/testyuv_cvt.h +16 -0
  1290. data/ext/alphatau/native/sdl/test/torturethread.c +113 -0
  1291. data/ext/alphatau/native/sdl/test/utf8.txt +287 -0
  1292. data/ext/alphatau/native/sdl/visualtest/COPYING.txt +18 -0
  1293. data/ext/alphatau/native/sdl/visualtest/Makefile.in +37 -0
  1294. data/ext/alphatau/native/sdl/visualtest/README.txt +214 -0
  1295. data/ext/alphatau/native/sdl/visualtest/acinclude.m4 +359 -0
  1296. data/ext/alphatau/native/sdl/visualtest/autogen.sh +12 -0
  1297. data/ext/alphatau/native/sdl/visualtest/compile +1 -0
  1298. data/ext/alphatau/native/sdl/visualtest/config.h +23 -0
  1299. data/ext/alphatau/native/sdl/visualtest/config.h.in +22 -0
  1300. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.actions +3 -0
  1301. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.config +5 -0
  1302. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_blendmodes/testsprite2_blendmodes.parameters +5 -0
  1303. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.actions +1 -0
  1304. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.config +5 -0
  1305. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_crashtest/testsprite2_crashtest.parameters +24 -0
  1306. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.actions +3 -0
  1307. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.config +5 -0
  1308. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_fullscreen/testsprite2_fullscreen.parameters +5 -0
  1309. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_geometry/testsprite2_geometry.actions +3 -0
  1310. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_geometry/testsprite2_geometry.config +5 -0
  1311. data/ext/alphatau/native/sdl/visualtest/configs/testsprite2_geometry/testsprite2_geometry.parameters +5 -0
  1312. data/ext/alphatau/native/sdl/visualtest/configure +5203 -0
  1313. data/ext/alphatau/native/sdl/visualtest/configure.in +166 -0
  1314. data/ext/alphatau/native/sdl/visualtest/depcomp +1 -0
  1315. data/ext/alphatau/native/sdl/visualtest/docs/Doxyfile +1936 -0
  1316. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_action_configparser.h +149 -0
  1317. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_exhaustive_variator.h +64 -0
  1318. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_harness_argparser.h +75 -0
  1319. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_mischelper.h +28 -0
  1320. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_parsehelper.h +46 -0
  1321. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_process.h +112 -0
  1322. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_random_variator.h +61 -0
  1323. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_rwhelper.h +87 -0
  1324. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_screenshot.h +52 -0
  1325. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_sut_configparser.h +105 -0
  1326. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_variator_common.h +122 -0
  1327. data/ext/alphatau/native/sdl/visualtest/include/SDL_visualtest_variators.h +66 -0
  1328. data/ext/alphatau/native/sdl/visualtest/install-sh +1 -0
  1329. data/ext/alphatau/native/sdl/visualtest/launch_harness.cmd +2 -0
  1330. data/ext/alphatau/native/sdl/visualtest/launch_harness.sh +6 -0
  1331. data/ext/alphatau/native/sdl/visualtest/missing +1 -0
  1332. data/ext/alphatau/native/sdl/visualtest/src/action_configparser.c +396 -0
  1333. data/ext/alphatau/native/sdl/visualtest/src/harness_argparser.c +358 -0
  1334. data/ext/alphatau/native/sdl/visualtest/src/linux/linux_process.c +199 -0
  1335. data/ext/alphatau/native/sdl/visualtest/src/mischelper.c +28 -0
  1336. data/ext/alphatau/native/sdl/visualtest/src/parsehelper.c +231 -0
  1337. data/ext/alphatau/native/sdl/visualtest/src/rwhelper.c +131 -0
  1338. data/ext/alphatau/native/sdl/visualtest/src/screenshot.c +136 -0
  1339. data/ext/alphatau/native/sdl/visualtest/src/sut_configparser.c +232 -0
  1340. data/ext/alphatau/native/sdl/visualtest/src/testharness.c +533 -0
  1341. data/ext/alphatau/native/sdl/visualtest/src/variator_common.c +225 -0
  1342. data/ext/alphatau/native/sdl/visualtest/src/variator_exhaustive.c +132 -0
  1343. data/ext/alphatau/native/sdl/visualtest/src/variator_random.c +111 -0
  1344. data/ext/alphatau/native/sdl/visualtest/src/variators.c +93 -0
  1345. data/ext/alphatau/native/sdl/visualtest/src/windows/windows_process.c +284 -0
  1346. data/ext/alphatau/native/sdl/visualtest/src/windows/windows_screenshot.c +349 -0
  1347. data/ext/alphatau/native/sdl/visualtest/stamp-h1 +1 -0
  1348. data/ext/alphatau/native/sdl/visualtest/testsprite2_sample.actions +3 -0
  1349. data/ext/alphatau/native/sdl/visualtest/testsprite2_sample.config +6 -0
  1350. data/ext/alphatau/native/sdl/visualtest/testsprite2_sample.parameters +29 -0
  1351. data/ext/alphatau/native/sdl/visualtest/unittest/testquit.actions +1 -0
  1352. data/ext/alphatau/native/sdl/visualtest/unittest/testquit.c +101 -0
  1353. data/ext/alphatau/native/sdl/visualtest/unittest/testquit.config +5 -0
  1354. data/ext/alphatau/native/sdl/visualtest/unittest/testquit.parameters +3 -0
  1355. data/ext/alphatau/native/sdl/wayland-protocols/pointer-constraints-unstable-v1.xml +339 -0
  1356. data/ext/alphatau/native/sdl/wayland-protocols/relative-pointer-unstable-v1.xml +136 -0
  1357. data/ext/alphatau/native/sdl/wayland-protocols/wayland.xml +2746 -0
  1358. data/ext/alphatau/native/sdl/wayland-protocols/xdg-shell-unstable-v6.xml +1044 -0
  1359. data/ext/alphatau/native/sdl/wayland-protocols/xdg-shell.xml +1120 -0
  1360. data/lib/alphatau.rb +12 -0
  1361. data/lib/alphatau/version.rb +3 -0
  1362. metadata +1465 -0
@@ -0,0 +1,274 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+ #include "../../SDL_internal.h"
22
+
23
+ #include "SDL_render.h"
24
+ #include "SDL_system.h"
25
+
26
+ #if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
27
+
28
+ #include "../../core/windows/SDL_windows.h"
29
+
30
+ #include <d3d9.h>
31
+
32
+ #include "SDL_shaders_d3d.h"
33
+
34
+ /* The shaders here were compiled with:
35
+
36
+ fxc /T ps_2_0 /Fo"<OUTPUT FILE>" "<INPUT FILE>"
37
+
38
+ Shader object code was converted to a list of DWORDs via the following
39
+ *nix style command (available separately from Windows + MSVC):
40
+
41
+ hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
42
+ */
43
+
44
+ /* --- D3D9_PixelShader_YUV_JPEG.hlsl ---
45
+ Texture2D theTextureY : register(t0);
46
+ Texture2D theTextureU : register(t1);
47
+ Texture2D theTextureV : register(t2);
48
+ SamplerState theSampler = sampler_state
49
+ {
50
+ addressU = Clamp;
51
+ addressV = Clamp;
52
+ mipfilter = NONE;
53
+ minfilter = LINEAR;
54
+ magfilter = LINEAR;
55
+ };
56
+
57
+ struct PixelShaderInput
58
+ {
59
+ float4 pos : SV_POSITION;
60
+ float2 tex : TEXCOORD0;
61
+ float4 color : COLOR0;
62
+ };
63
+
64
+ float4 main(PixelShaderInput input) : SV_TARGET
65
+ {
66
+ const float3 offset = {0.0, -0.501960814, -0.501960814};
67
+ const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
68
+ const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
69
+ const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
70
+
71
+ float4 Output;
72
+
73
+ float3 yuv;
74
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
75
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
76
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
77
+
78
+ yuv += offset;
79
+ Output.r = dot(yuv, Rcoeff);
80
+ Output.g = dot(yuv, Gcoeff);
81
+ Output.b = dot(yuv, Bcoeff);
82
+ Output.a = 1.0f;
83
+
84
+ return Output * input.color;
85
+ }
86
+ */
87
+ static const DWORD D3D9_PixelShader_YUV_JPEG[] = {
88
+ 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
89
+ 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
90
+ 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
91
+ 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
92
+ 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
93
+ 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
94
+ 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
95
+ 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
96
+ 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
97
+ 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
98
+ 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
99
+ 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
100
+ 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
101
+ 0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002,
102
+ 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
103
+ 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
104
+ 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
105
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
106
+ 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
107
+ 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
108
+ 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
109
+ 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
110
+ 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
111
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
112
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
113
+ 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
114
+ };
115
+
116
+ /* --- D3D9_PixelShader_YUV_BT601.hlsl ---
117
+ Texture2D theTextureY : register(t0);
118
+ Texture2D theTextureU : register(t1);
119
+ Texture2D theTextureV : register(t2);
120
+ SamplerState theSampler = sampler_state
121
+ {
122
+ addressU = Clamp;
123
+ addressV = Clamp;
124
+ mipfilter = NONE;
125
+ minfilter = LINEAR;
126
+ magfilter = LINEAR;
127
+ };
128
+
129
+ struct PixelShaderInput
130
+ {
131
+ float4 pos : SV_POSITION;
132
+ float2 tex : TEXCOORD0;
133
+ float4 color : COLOR0;
134
+ };
135
+
136
+ float4 main(PixelShaderInput input) : SV_TARGET
137
+ {
138
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
139
+ const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
140
+ const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
141
+ const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
142
+
143
+ float4 Output;
144
+
145
+ float3 yuv;
146
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
147
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
148
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
149
+
150
+ yuv += offset;
151
+ Output.r = dot(yuv, Rcoeff);
152
+ Output.g = dot(yuv, Gcoeff);
153
+ Output.b = dot(yuv, Bcoeff);
154
+ Output.a = 1.0f;
155
+
156
+ return Output * input.color;
157
+ }
158
+ */
159
+ static const DWORD D3D9_PixelShader_YUV_BT601[] = {
160
+ 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
161
+ 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
162
+ 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
163
+ 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
164
+ 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
165
+ 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
166
+ 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
167
+ 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
168
+ 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
169
+ 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
170
+ 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
171
+ 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
172
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
173
+ 0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002,
174
+ 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
175
+ 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
176
+ 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
177
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
178
+ 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
179
+ 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
180
+ 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
181
+ 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
182
+ 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
183
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
184
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
185
+ 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
186
+ };
187
+
188
+ /* --- D3D9_PixelShader_YUV_BT709.hlsl ---
189
+ Texture2D theTextureY : register(t0);
190
+ Texture2D theTextureU : register(t1);
191
+ Texture2D theTextureV : register(t2);
192
+ SamplerState theSampler = sampler_state
193
+ {
194
+ addressU = Clamp;
195
+ addressV = Clamp;
196
+ mipfilter = NONE;
197
+ minfilter = LINEAR;
198
+ magfilter = LINEAR;
199
+ };
200
+
201
+ struct PixelShaderInput
202
+ {
203
+ float4 pos : SV_POSITION;
204
+ float2 tex : TEXCOORD0;
205
+ float4 color : COLOR0;
206
+ };
207
+
208
+ float4 main(PixelShaderInput input) : SV_TARGET
209
+ {
210
+ const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
211
+ const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
212
+ const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
213
+ const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
214
+
215
+ float4 Output;
216
+
217
+ float3 yuv;
218
+ yuv.x = theTextureY.Sample(theSampler, input.tex).r;
219
+ yuv.y = theTextureU.Sample(theSampler, input.tex).r;
220
+ yuv.z = theTextureV.Sample(theSampler, input.tex).r;
221
+
222
+ yuv += offset;
223
+ Output.r = dot(yuv, Rcoeff);
224
+ Output.g = dot(yuv, Gcoeff);
225
+ Output.b = dot(yuv, Bcoeff);
226
+ Output.a = 1.0f;
227
+
228
+ return Output * input.color;
229
+ }
230
+ */
231
+ static const DWORD D3D9_PixelShader_YUV_BT709[] = {
232
+ 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
233
+ 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
234
+ 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
235
+ 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
236
+ 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
237
+ 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
238
+ 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
239
+ 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
240
+ 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
241
+ 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
242
+ 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
243
+ 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
244
+ 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
245
+ 0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002,
246
+ 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
247
+ 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
248
+ 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
249
+ 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
250
+ 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
251
+ 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
252
+ 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
253
+ 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
254
+ 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
255
+ 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
256
+ 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
257
+ 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
258
+ };
259
+
260
+
261
+ static const DWORD *D3D9_shaders[] = {
262
+ D3D9_PixelShader_YUV_JPEG,
263
+ D3D9_PixelShader_YUV_BT601,
264
+ D3D9_PixelShader_YUV_BT709,
265
+ };
266
+
267
+ HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader)
268
+ {
269
+ return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader);
270
+ }
271
+
272
+ #endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
273
+
274
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,34 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+ #include "../../SDL_internal.h"
22
+
23
+ /* D3D9 shader implementation */
24
+
25
+ typedef enum {
26
+ SHADER_YUV_JPEG,
27
+ SHADER_YUV_BT601,
28
+ SHADER_YUV_BT709,
29
+ NUM_SHADERS
30
+ } D3D9_Shader;
31
+
32
+ extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader);
33
+
34
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,2559 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+ #include "../../SDL_internal.h"
22
+
23
+ #if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
24
+
25
+ #define COBJMACROS
26
+ #include "../../core/windows/SDL_windows.h"
27
+ #include "SDL_hints.h"
28
+ #include "SDL_loadso.h"
29
+ #include "SDL_syswm.h"
30
+ #include "../SDL_sysrender.h"
31
+ #include "../SDL_d3dmath.h"
32
+
33
+ #include <d3d11_1.h>
34
+
35
+ #include "SDL_shaders_d3d11.h"
36
+
37
+ #ifdef __WINRT__
38
+
39
+ #if NTDDI_VERSION > NTDDI_WIN8
40
+ #include <DXGI1_3.h>
41
+ #endif
42
+
43
+ #include "SDL_render_winrt.h"
44
+
45
+ #if WINAPI_FAMILY == WINAPI_FAMILY_APP
46
+ #include <windows.ui.xaml.media.dxinterop.h>
47
+ /* TODO, WinRT, XAML: get the ISwapChainBackgroundPanelNative from something other than a global var */
48
+ extern ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative;
49
+ #endif /* WINAPI_FAMILY == WINAPI_FAMILY_APP */
50
+
51
+ #endif /* __WINRT__ */
52
+
53
+
54
+ #define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
55
+
56
+ #define SAFE_RELEASE(X) if ((X)) { IUnknown_Release(SDL_static_cast(IUnknown*, X)); X = NULL; }
57
+
58
+
59
+ /* Vertex shader, common values */
60
+ typedef struct
61
+ {
62
+ Float4X4 model;
63
+ Float4X4 projectionAndView;
64
+ } VertexShaderConstants;
65
+
66
+ /* Per-vertex data */
67
+ typedef struct
68
+ {
69
+ Float3 pos;
70
+ Float2 tex;
71
+ Float4 color;
72
+ } VertexPositionColor;
73
+
74
+ /* Per-texture data */
75
+ typedef struct
76
+ {
77
+ ID3D11Texture2D *mainTexture;
78
+ ID3D11ShaderResourceView *mainTextureResourceView;
79
+ ID3D11RenderTargetView *mainTextureRenderTargetView;
80
+ ID3D11Texture2D *stagingTexture;
81
+ int lockedTexturePositionX;
82
+ int lockedTexturePositionY;
83
+ D3D11_FILTER scaleMode;
84
+
85
+ /* YV12 texture support */
86
+ SDL_bool yuv;
87
+ ID3D11Texture2D *mainTextureU;
88
+ ID3D11ShaderResourceView *mainTextureResourceViewU;
89
+ ID3D11Texture2D *mainTextureV;
90
+ ID3D11ShaderResourceView *mainTextureResourceViewV;
91
+
92
+ /* NV12 texture support */
93
+ SDL_bool nv12;
94
+ ID3D11Texture2D *mainTextureNV;
95
+ ID3D11ShaderResourceView *mainTextureResourceViewNV;
96
+
97
+ Uint8 *pixels;
98
+ int pitch;
99
+ SDL_Rect locked_rect;
100
+ } D3D11_TextureData;
101
+
102
+ /* Blend mode data */
103
+ typedef struct
104
+ {
105
+ SDL_BlendMode blendMode;
106
+ ID3D11BlendState *blendState;
107
+ } D3D11_BlendMode;
108
+
109
+ /* Private renderer data */
110
+ typedef struct
111
+ {
112
+ void *hDXGIMod;
113
+ void *hD3D11Mod;
114
+ IDXGIFactory2 *dxgiFactory;
115
+ IDXGIAdapter *dxgiAdapter;
116
+ ID3D11Device1 *d3dDevice;
117
+ ID3D11DeviceContext1 *d3dContext;
118
+ IDXGISwapChain1 *swapChain;
119
+ DXGI_SWAP_EFFECT swapEffect;
120
+ ID3D11RenderTargetView *mainRenderTargetView;
121
+ ID3D11RenderTargetView *currentOffscreenRenderTargetView;
122
+ ID3D11InputLayout *inputLayout;
123
+ ID3D11Buffer *vertexBuffer;
124
+ ID3D11VertexShader *vertexShader;
125
+ ID3D11PixelShader *pixelShaders[NUM_SHADERS];
126
+ int blendModesCount;
127
+ D3D11_BlendMode *blendModes;
128
+ ID3D11SamplerState *nearestPixelSampler;
129
+ ID3D11SamplerState *linearSampler;
130
+ D3D_FEATURE_LEVEL featureLevel;
131
+
132
+ /* Rasterizers */
133
+ ID3D11RasterizerState *mainRasterizer;
134
+ ID3D11RasterizerState *clippedRasterizer;
135
+
136
+ /* Vertex buffer constants */
137
+ VertexShaderConstants vertexShaderConstantsData;
138
+ ID3D11Buffer *vertexShaderConstants;
139
+
140
+ /* Cached renderer properties */
141
+ DXGI_MODE_ROTATION rotation;
142
+ ID3D11RenderTargetView *currentRenderTargetView;
143
+ ID3D11RasterizerState *currentRasterizerState;
144
+ ID3D11BlendState *currentBlendState;
145
+ ID3D11PixelShader *currentShader;
146
+ ID3D11ShaderResourceView *currentShaderResource;
147
+ ID3D11SamplerState *currentSampler;
148
+ } D3D11_RenderData;
149
+
150
+
151
+ /* Define D3D GUIDs here so we don't have to include uuid.lib.
152
+ *
153
+ * Fix for SDL bug https://bugzilla.libsdl.org/show_bug.cgi?id=3437:
154
+ * The extra 'SDL_' was added to the start of each IID's name, in order
155
+ * to prevent build errors on both MinGW-w64 and WinRT/UWP.
156
+ * (SDL bug https://bugzilla.libsdl.org/show_bug.cgi?id=3336 led to
157
+ * linker errors in WinRT/UWP builds.)
158
+ */
159
+
160
+ #ifdef __GNUC__
161
+ #pragma GCC diagnostic push
162
+ #pragma GCC diagnostic ignored "-Wunused-const-variable"
163
+ #endif
164
+
165
+ static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
166
+ static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
167
+ static const GUID SDL_IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
168
+ static const GUID SDL_IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
169
+ static const GUID SDL_IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } };
170
+ static const GUID SDL_IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } };
171
+ static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };
172
+
173
+ #ifdef __GNUC__
174
+ #pragma GCC diagnostic pop
175
+ #endif
176
+
177
+
178
+ /* Direct3D 11.1 renderer implementation */
179
+ static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
180
+ static void D3D11_WindowEvent(SDL_Renderer * renderer,
181
+ const SDL_WindowEvent *event);
182
+ static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
183
+ static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
184
+ static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
185
+ const SDL_Rect * rect, const void *srcPixels,
186
+ int srcPitch);
187
+ static int D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
188
+ const SDL_Rect * rect,
189
+ const Uint8 *Yplane, int Ypitch,
190
+ const Uint8 *Uplane, int Upitch,
191
+ const Uint8 *Vplane, int Vpitch);
192
+ static int D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
193
+ const SDL_Rect * rect, void **pixels, int *pitch);
194
+ static void D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
195
+ static int D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
196
+ static int D3D11_UpdateViewport(SDL_Renderer * renderer);
197
+ static int D3D11_UpdateClipRect(SDL_Renderer * renderer);
198
+ static int D3D11_RenderClear(SDL_Renderer * renderer);
199
+ static int D3D11_RenderDrawPoints(SDL_Renderer * renderer,
200
+ const SDL_FPoint * points, int count);
201
+ static int D3D11_RenderDrawLines(SDL_Renderer * renderer,
202
+ const SDL_FPoint * points, int count);
203
+ static int D3D11_RenderFillRects(SDL_Renderer * renderer,
204
+ const SDL_FRect * rects, int count);
205
+ static int D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
206
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect);
207
+ static int D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
208
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
209
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
210
+ static int D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
211
+ Uint32 format, void * pixels, int pitch);
212
+ static void D3D11_RenderPresent(SDL_Renderer * renderer);
213
+ static void D3D11_DestroyTexture(SDL_Renderer * renderer,
214
+ SDL_Texture * texture);
215
+ static void D3D11_DestroyRenderer(SDL_Renderer * renderer);
216
+
217
+ /* Direct3D 11.1 Internal Functions */
218
+ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
219
+ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
220
+ static HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
221
+ static HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
222
+ static void D3D11_ReleaseMainRenderTargetView(SDL_Renderer * renderer);
223
+
224
+ SDL_RenderDriver D3D11_RenderDriver = {
225
+ D3D11_CreateRenderer,
226
+ {
227
+ "direct3d11",
228
+ (
229
+ SDL_RENDERER_ACCELERATED |
230
+ SDL_RENDERER_PRESENTVSYNC |
231
+ SDL_RENDERER_TARGETTEXTURE
232
+ ), /* flags. see SDL_RendererFlags */
233
+ 6, /* num_texture_formats */
234
+ { /* texture_formats */
235
+ SDL_PIXELFORMAT_ARGB8888,
236
+ SDL_PIXELFORMAT_RGB888,
237
+ SDL_PIXELFORMAT_YV12,
238
+ SDL_PIXELFORMAT_IYUV,
239
+ SDL_PIXELFORMAT_NV12,
240
+ SDL_PIXELFORMAT_NV21
241
+ },
242
+ 0, /* max_texture_width: will be filled in later */
243
+ 0 /* max_texture_height: will be filled in later */
244
+ }
245
+ };
246
+
247
+
248
+ Uint32
249
+ D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
250
+ {
251
+ switch (dxgiFormat) {
252
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
253
+ return SDL_PIXELFORMAT_ARGB8888;
254
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
255
+ return SDL_PIXELFORMAT_RGB888;
256
+ default:
257
+ return SDL_PIXELFORMAT_UNKNOWN;
258
+ }
259
+ }
260
+
261
+ static DXGI_FORMAT
262
+ SDLPixelFormatToDXGIFormat(Uint32 sdlFormat)
263
+ {
264
+ switch (sdlFormat) {
265
+ case SDL_PIXELFORMAT_ARGB8888:
266
+ return DXGI_FORMAT_B8G8R8A8_UNORM;
267
+ case SDL_PIXELFORMAT_RGB888:
268
+ return DXGI_FORMAT_B8G8R8X8_UNORM;
269
+ case SDL_PIXELFORMAT_YV12:
270
+ case SDL_PIXELFORMAT_IYUV:
271
+ case SDL_PIXELFORMAT_NV12: /* For the Y texture */
272
+ case SDL_PIXELFORMAT_NV21: /* For the Y texture */
273
+ return DXGI_FORMAT_R8_UNORM;
274
+ default:
275
+ return DXGI_FORMAT_UNKNOWN;
276
+ }
277
+ }
278
+
279
+ SDL_Renderer *
280
+ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
281
+ {
282
+ SDL_Renderer *renderer;
283
+ D3D11_RenderData *data;
284
+
285
+ renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
286
+ if (!renderer) {
287
+ SDL_OutOfMemory();
288
+ return NULL;
289
+ }
290
+
291
+ data = (D3D11_RenderData *) SDL_calloc(1, sizeof(*data));
292
+ if (!data) {
293
+ SDL_OutOfMemory();
294
+ return NULL;
295
+ }
296
+
297
+ renderer->WindowEvent = D3D11_WindowEvent;
298
+ renderer->SupportsBlendMode = D3D11_SupportsBlendMode;
299
+ renderer->CreateTexture = D3D11_CreateTexture;
300
+ renderer->UpdateTexture = D3D11_UpdateTexture;
301
+ renderer->UpdateTextureYUV = D3D11_UpdateTextureYUV;
302
+ renderer->LockTexture = D3D11_LockTexture;
303
+ renderer->UnlockTexture = D3D11_UnlockTexture;
304
+ renderer->SetRenderTarget = D3D11_SetRenderTarget;
305
+ renderer->UpdateViewport = D3D11_UpdateViewport;
306
+ renderer->UpdateClipRect = D3D11_UpdateClipRect;
307
+ renderer->RenderClear = D3D11_RenderClear;
308
+ renderer->RenderDrawPoints = D3D11_RenderDrawPoints;
309
+ renderer->RenderDrawLines = D3D11_RenderDrawLines;
310
+ renderer->RenderFillRects = D3D11_RenderFillRects;
311
+ renderer->RenderCopy = D3D11_RenderCopy;
312
+ renderer->RenderCopyEx = D3D11_RenderCopyEx;
313
+ renderer->RenderReadPixels = D3D11_RenderReadPixels;
314
+ renderer->RenderPresent = D3D11_RenderPresent;
315
+ renderer->DestroyTexture = D3D11_DestroyTexture;
316
+ renderer->DestroyRenderer = D3D11_DestroyRenderer;
317
+ renderer->info = D3D11_RenderDriver.info;
318
+ renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
319
+ renderer->driverdata = data;
320
+
321
+ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
322
+ /* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1.
323
+ * Failure to use it seems to either result in:
324
+ *
325
+ * - with the D3D11 debug runtime turned OFF, vsync seemingly gets turned
326
+ * off (framerate doesn't get capped), but nothing appears on-screen
327
+ *
328
+ * - with the D3D11 debug runtime turned ON, vsync gets automatically
329
+ * turned back on, and the following gets output to the debug console:
330
+ *
331
+ * DXGI ERROR: IDXGISwapChain::Present: Interval 0 is not supported, changed to Interval 1. [ UNKNOWN ERROR #1024: ]
332
+ */
333
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
334
+ #else
335
+ if ((flags & SDL_RENDERER_PRESENTVSYNC)) {
336
+ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
337
+ }
338
+ #endif
339
+
340
+ /* HACK: make sure the SDL_Renderer references the SDL_Window data now, in
341
+ * order to give init functions access to the underlying window handle:
342
+ */
343
+ renderer->window = window;
344
+
345
+ /* Initialize Direct3D resources */
346
+ if (FAILED(D3D11_CreateDeviceResources(renderer))) {
347
+ D3D11_DestroyRenderer(renderer);
348
+ return NULL;
349
+ }
350
+ if (FAILED(D3D11_CreateWindowSizeDependentResources(renderer))) {
351
+ D3D11_DestroyRenderer(renderer);
352
+ return NULL;
353
+ }
354
+
355
+ return renderer;
356
+ }
357
+
358
+ static void
359
+ D3D11_ReleaseAll(SDL_Renderer * renderer)
360
+ {
361
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
362
+ SDL_Texture *texture = NULL;
363
+
364
+ /* Release all textures */
365
+ for (texture = renderer->textures; texture; texture = texture->next) {
366
+ D3D11_DestroyTexture(renderer, texture);
367
+ }
368
+
369
+ /* Release/reset everything else */
370
+ if (data) {
371
+ int i;
372
+
373
+ SAFE_RELEASE(data->dxgiFactory);
374
+ SAFE_RELEASE(data->dxgiAdapter);
375
+ SAFE_RELEASE(data->d3dDevice);
376
+ SAFE_RELEASE(data->d3dContext);
377
+ SAFE_RELEASE(data->swapChain);
378
+ SAFE_RELEASE(data->mainRenderTargetView);
379
+ SAFE_RELEASE(data->currentOffscreenRenderTargetView);
380
+ SAFE_RELEASE(data->inputLayout);
381
+ SAFE_RELEASE(data->vertexBuffer);
382
+ SAFE_RELEASE(data->vertexShader);
383
+ for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
384
+ SAFE_RELEASE(data->pixelShaders[i]);
385
+ }
386
+ if (data->blendModesCount > 0) {
387
+ for (i = 0; i < data->blendModesCount; ++i) {
388
+ SAFE_RELEASE(data->blendModes[i].blendState);
389
+ }
390
+ SDL_free(data->blendModes);
391
+
392
+ data->blendModesCount = 0;
393
+ }
394
+ SAFE_RELEASE(data->nearestPixelSampler);
395
+ SAFE_RELEASE(data->linearSampler);
396
+ SAFE_RELEASE(data->mainRasterizer);
397
+ SAFE_RELEASE(data->clippedRasterizer);
398
+ SAFE_RELEASE(data->vertexShaderConstants);
399
+
400
+ data->swapEffect = (DXGI_SWAP_EFFECT) 0;
401
+ data->rotation = DXGI_MODE_ROTATION_UNSPECIFIED;
402
+ data->currentRenderTargetView = NULL;
403
+ data->currentRasterizerState = NULL;
404
+ data->currentBlendState = NULL;
405
+ data->currentShader = NULL;
406
+ data->currentShaderResource = NULL;
407
+ data->currentSampler = NULL;
408
+
409
+ /* Unload the D3D libraries. This should be done last, in order
410
+ * to prevent IUnknown::Release() calls from crashing.
411
+ */
412
+ if (data->hD3D11Mod) {
413
+ SDL_UnloadObject(data->hD3D11Mod);
414
+ data->hD3D11Mod = NULL;
415
+ }
416
+ if (data->hDXGIMod) {
417
+ SDL_UnloadObject(data->hDXGIMod);
418
+ data->hDXGIMod = NULL;
419
+ }
420
+ }
421
+ }
422
+
423
+ static void
424
+ D3D11_DestroyRenderer(SDL_Renderer * renderer)
425
+ {
426
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
427
+ D3D11_ReleaseAll(renderer);
428
+ if (data) {
429
+ SDL_free(data);
430
+ }
431
+ SDL_free(renderer);
432
+ }
433
+
434
+ static D3D11_BLEND GetBlendFunc(SDL_BlendFactor factor)
435
+ {
436
+ switch (factor) {
437
+ case SDL_BLENDFACTOR_ZERO:
438
+ return D3D11_BLEND_ZERO;
439
+ case SDL_BLENDFACTOR_ONE:
440
+ return D3D11_BLEND_ONE;
441
+ case SDL_BLENDFACTOR_SRC_COLOR:
442
+ return D3D11_BLEND_SRC_COLOR;
443
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
444
+ return D3D11_BLEND_INV_SRC_COLOR;
445
+ case SDL_BLENDFACTOR_SRC_ALPHA:
446
+ return D3D11_BLEND_SRC_ALPHA;
447
+ case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
448
+ return D3D11_BLEND_INV_SRC_ALPHA;
449
+ case SDL_BLENDFACTOR_DST_COLOR:
450
+ return D3D11_BLEND_DEST_COLOR;
451
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
452
+ return D3D11_BLEND_INV_DEST_COLOR;
453
+ case SDL_BLENDFACTOR_DST_ALPHA:
454
+ return D3D11_BLEND_DEST_ALPHA;
455
+ case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
456
+ return D3D11_BLEND_INV_DEST_ALPHA;
457
+ default:
458
+ return (D3D11_BLEND)0;
459
+ }
460
+ }
461
+
462
+ static D3D11_BLEND_OP GetBlendEquation(SDL_BlendOperation operation)
463
+ {
464
+ switch (operation) {
465
+ case SDL_BLENDOPERATION_ADD:
466
+ return D3D11_BLEND_OP_ADD;
467
+ case SDL_BLENDOPERATION_SUBTRACT:
468
+ return D3D11_BLEND_OP_SUBTRACT;
469
+ case SDL_BLENDOPERATION_REV_SUBTRACT:
470
+ return D3D11_BLEND_OP_REV_SUBTRACT;
471
+ case SDL_BLENDOPERATION_MINIMUM:
472
+ return D3D11_BLEND_OP_MIN;
473
+ case SDL_BLENDOPERATION_MAXIMUM:
474
+ return D3D11_BLEND_OP_MAX;
475
+ default:
476
+ return (D3D11_BLEND_OP)0;
477
+ }
478
+ }
479
+
480
+ static SDL_bool
481
+ D3D11_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode)
482
+ {
483
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
484
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
485
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
486
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
487
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
488
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
489
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
490
+ ID3D11BlendState *blendState = NULL;
491
+ D3D11_BlendMode *blendModes;
492
+ HRESULT result = S_OK;
493
+
494
+ D3D11_BLEND_DESC blendDesc;
495
+ SDL_zero(blendDesc);
496
+ blendDesc.AlphaToCoverageEnable = FALSE;
497
+ blendDesc.IndependentBlendEnable = FALSE;
498
+ blendDesc.RenderTarget[0].BlendEnable = TRUE;
499
+ blendDesc.RenderTarget[0].SrcBlend = GetBlendFunc(srcColorFactor);
500
+ blendDesc.RenderTarget[0].DestBlend = GetBlendFunc(dstColorFactor);
501
+ blendDesc.RenderTarget[0].BlendOp = GetBlendEquation(colorOperation);
502
+ blendDesc.RenderTarget[0].SrcBlendAlpha = GetBlendFunc(srcAlphaFactor);
503
+ blendDesc.RenderTarget[0].DestBlendAlpha = GetBlendFunc(dstAlphaFactor);
504
+ blendDesc.RenderTarget[0].BlendOpAlpha = GetBlendEquation(alphaOperation);
505
+ blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
506
+ result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, &blendState);
507
+ if (FAILED(result)) {
508
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBlendState"), result);
509
+ return SDL_FALSE;
510
+ }
511
+
512
+ blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes));
513
+ if (!blendModes) {
514
+ SAFE_RELEASE(blendState);
515
+ SDL_OutOfMemory();
516
+ return SDL_FALSE;
517
+ }
518
+ blendModes[data->blendModesCount].blendMode = blendMode;
519
+ blendModes[data->blendModesCount].blendState = blendState;
520
+ data->blendModes = blendModes;
521
+ ++data->blendModesCount;
522
+
523
+ return SDL_TRUE;
524
+ }
525
+
526
+ /* Create resources that depend on the device. */
527
+ static HRESULT
528
+ D3D11_CreateDeviceResources(SDL_Renderer * renderer)
529
+ {
530
+ typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);
531
+ PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc;
532
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
533
+ PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc;
534
+ ID3D11Device *d3dDevice = NULL;
535
+ ID3D11DeviceContext *d3dContext = NULL;
536
+ IDXGIDevice1 *dxgiDevice = NULL;
537
+ HRESULT result = S_OK;
538
+ UINT creationFlags;
539
+ int i;
540
+
541
+ /* This array defines the set of DirectX hardware feature levels this app will support.
542
+ * Note the ordering should be preserved.
543
+ * Don't forget to declare your application's minimum required feature level in its
544
+ * description. All applications are assumed to support 9.1 unless otherwise stated.
545
+ */
546
+ D3D_FEATURE_LEVEL featureLevels[] =
547
+ {
548
+ D3D_FEATURE_LEVEL_11_1,
549
+ D3D_FEATURE_LEVEL_11_0,
550
+ D3D_FEATURE_LEVEL_10_1,
551
+ D3D_FEATURE_LEVEL_10_0,
552
+ D3D_FEATURE_LEVEL_9_3,
553
+ D3D_FEATURE_LEVEL_9_2,
554
+ D3D_FEATURE_LEVEL_9_1
555
+ };
556
+
557
+ D3D11_BUFFER_DESC constantBufferDesc;
558
+ D3D11_SAMPLER_DESC samplerDesc;
559
+ D3D11_RASTERIZER_DESC rasterDesc;
560
+
561
+ #ifdef __WINRT__
562
+ CreateDXGIFactoryFunc = CreateDXGIFactory1;
563
+ D3D11CreateDeviceFunc = D3D11CreateDevice;
564
+ #else
565
+ data->hDXGIMod = SDL_LoadObject("dxgi.dll");
566
+ if (!data->hDXGIMod) {
567
+ result = E_FAIL;
568
+ goto done;
569
+ }
570
+
571
+ CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
572
+ if (!CreateDXGIFactoryFunc) {
573
+ result = E_FAIL;
574
+ goto done;
575
+ }
576
+
577
+ data->hD3D11Mod = SDL_LoadObject("d3d11.dll");
578
+ if (!data->hD3D11Mod) {
579
+ result = E_FAIL;
580
+ goto done;
581
+ }
582
+
583
+ D3D11CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
584
+ if (!D3D11CreateDeviceFunc) {
585
+ result = E_FAIL;
586
+ goto done;
587
+ }
588
+ #endif /* __WINRT__ */
589
+
590
+ result = CreateDXGIFactoryFunc(&SDL_IID_IDXGIFactory2, (void **)&data->dxgiFactory);
591
+ if (FAILED(result)) {
592
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result);
593
+ goto done;
594
+ }
595
+
596
+ /* FIXME: Should we use the default adapter? */
597
+ result = IDXGIFactory2_EnumAdapters(data->dxgiFactory, 0, &data->dxgiAdapter);
598
+ if (FAILED(result)) {
599
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result);
600
+ goto done;
601
+ }
602
+
603
+ /* This flag adds support for surfaces with a different color channel ordering
604
+ * than the API default. It is required for compatibility with Direct2D.
605
+ */
606
+ creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
607
+
608
+ /* Make sure Direct3D's debugging feature gets used, if the app requests it. */
609
+ if (SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE)) {
610
+ creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
611
+ }
612
+
613
+ /* Create the Direct3D 11 API device object and a corresponding context. */
614
+ result = D3D11CreateDeviceFunc(
615
+ data->dxgiAdapter,
616
+ D3D_DRIVER_TYPE_UNKNOWN,
617
+ NULL,
618
+ creationFlags, /* Set set debug and Direct2D compatibility flags. */
619
+ featureLevels, /* List of feature levels this app can support. */
620
+ SDL_arraysize(featureLevels),
621
+ D3D11_SDK_VERSION, /* Always set this to D3D11_SDK_VERSION for Windows Store apps. */
622
+ &d3dDevice, /* Returns the Direct3D device created. */
623
+ &data->featureLevel, /* Returns feature level of device created. */
624
+ &d3dContext /* Returns the device immediate context. */
625
+ );
626
+ if (FAILED(result)) {
627
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result);
628
+ goto done;
629
+ }
630
+
631
+ result = ID3D11Device_QueryInterface(d3dDevice, &SDL_IID_ID3D11Device1, (void **)&data->d3dDevice);
632
+ if (FAILED(result)) {
633
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to ID3D11Device1"), result);
634
+ goto done;
635
+ }
636
+
637
+ result = ID3D11DeviceContext_QueryInterface(d3dContext, &SDL_IID_ID3D11DeviceContext1, (void **)&data->d3dContext);
638
+ if (FAILED(result)) {
639
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext to ID3D11DeviceContext1"), result);
640
+ goto done;
641
+ }
642
+
643
+ result = ID3D11Device_QueryInterface(d3dDevice, &SDL_IID_IDXGIDevice1, (void **)&dxgiDevice);
644
+ if (FAILED(result)) {
645
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to IDXGIDevice1"), result);
646
+ goto done;
647
+ }
648
+
649
+ /* Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
650
+ * ensures that the application will only render after each VSync, minimizing power consumption.
651
+ */
652
+ result = IDXGIDevice1_SetMaximumFrameLatency(dxgiDevice, 1);
653
+ if (FAILED(result)) {
654
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIDevice1::SetMaximumFrameLatency"), result);
655
+ goto done;
656
+ }
657
+
658
+ /* Make note of the maximum texture size
659
+ * Max texture sizes are documented on MSDN, at:
660
+ * http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
661
+ */
662
+ switch (data->featureLevel) {
663
+ case D3D_FEATURE_LEVEL_11_1:
664
+ case D3D_FEATURE_LEVEL_11_0:
665
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
666
+ break;
667
+
668
+ case D3D_FEATURE_LEVEL_10_1:
669
+ case D3D_FEATURE_LEVEL_10_0:
670
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
671
+ break;
672
+
673
+ case D3D_FEATURE_LEVEL_9_3:
674
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
675
+ break;
676
+
677
+ case D3D_FEATURE_LEVEL_9_2:
678
+ case D3D_FEATURE_LEVEL_9_1:
679
+ renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
680
+ break;
681
+
682
+ default:
683
+ SDL_SetError("%s, Unexpected feature level: %d", __FUNCTION__, data->featureLevel);
684
+ result = E_FAIL;
685
+ goto done;
686
+ }
687
+
688
+ if (D3D11_CreateVertexShader(data->d3dDevice, &data->vertexShader, &data->inputLayout) < 0) {
689
+ goto done;
690
+ }
691
+
692
+ for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
693
+ if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) {
694
+ goto done;
695
+ }
696
+ }
697
+
698
+ /* Setup space to hold vertex shader constants: */
699
+ SDL_zero(constantBufferDesc);
700
+ constantBufferDesc.ByteWidth = sizeof(VertexShaderConstants);
701
+ constantBufferDesc.Usage = D3D11_USAGE_DEFAULT;
702
+ constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
703
+ result = ID3D11Device_CreateBuffer(data->d3dDevice,
704
+ &constantBufferDesc,
705
+ NULL,
706
+ &data->vertexShaderConstants
707
+ );
708
+ if (FAILED(result)) {
709
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex shader constants]"), result);
710
+ goto done;
711
+ }
712
+
713
+ /* Create samplers to use when drawing textures: */
714
+ SDL_zero(samplerDesc);
715
+ samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
716
+ samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
717
+ samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
718
+ samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
719
+ samplerDesc.MipLODBias = 0.0f;
720
+ samplerDesc.MaxAnisotropy = 1;
721
+ samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
722
+ samplerDesc.MinLOD = 0.0f;
723
+ samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
724
+ result = ID3D11Device_CreateSamplerState(data->d3dDevice,
725
+ &samplerDesc,
726
+ &data->nearestPixelSampler
727
+ );
728
+ if (FAILED(result)) {
729
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [nearest-pixel filter]"), result);
730
+ goto done;
731
+ }
732
+
733
+ samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
734
+ result = ID3D11Device_CreateSamplerState(data->d3dDevice,
735
+ &samplerDesc,
736
+ &data->linearSampler
737
+ );
738
+ if (FAILED(result)) {
739
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [linear filter]"), result);
740
+ goto done;
741
+ }
742
+
743
+ /* Setup Direct3D rasterizer states */
744
+ SDL_zero(rasterDesc);
745
+ rasterDesc.AntialiasedLineEnable = FALSE;
746
+ rasterDesc.CullMode = D3D11_CULL_NONE;
747
+ rasterDesc.DepthBias = 0;
748
+ rasterDesc.DepthBiasClamp = 0.0f;
749
+ rasterDesc.DepthClipEnable = TRUE;
750
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
751
+ rasterDesc.FrontCounterClockwise = FALSE;
752
+ rasterDesc.MultisampleEnable = FALSE;
753
+ rasterDesc.ScissorEnable = FALSE;
754
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
755
+ result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->mainRasterizer);
756
+ if (FAILED(result)) {
757
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [main rasterizer]"), result);
758
+ goto done;
759
+ }
760
+
761
+ rasterDesc.ScissorEnable = TRUE;
762
+ result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->clippedRasterizer);
763
+ if (FAILED(result)) {
764
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [clipped rasterizer]"), result);
765
+ goto done;
766
+ }
767
+
768
+ /* Create blending states: */
769
+ if (!D3D11_CreateBlendState(renderer, SDL_BLENDMODE_BLEND) ||
770
+ !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_ADD) ||
771
+ !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_MOD)) {
772
+ /* D3D11_CreateBlendMode will set the SDL error, if it fails */
773
+ goto done;
774
+ }
775
+
776
+ /* Setup render state that doesn't change */
777
+ ID3D11DeviceContext_IASetInputLayout(data->d3dContext, data->inputLayout);
778
+ ID3D11DeviceContext_VSSetShader(data->d3dContext, data->vertexShader, NULL, 0);
779
+ ID3D11DeviceContext_VSSetConstantBuffers(data->d3dContext, 0, 1, &data->vertexShaderConstants);
780
+
781
+ done:
782
+ SAFE_RELEASE(d3dDevice);
783
+ SAFE_RELEASE(d3dContext);
784
+ SAFE_RELEASE(dxgiDevice);
785
+ return result;
786
+ }
787
+
788
+ #ifdef __WIN32__
789
+
790
+ static DXGI_MODE_ROTATION
791
+ D3D11_GetCurrentRotation()
792
+ {
793
+ /* FIXME */
794
+ return DXGI_MODE_ROTATION_IDENTITY;
795
+ }
796
+
797
+ #endif /* __WIN32__ */
798
+
799
+ static BOOL
800
+ D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation)
801
+ {
802
+ switch (rotation) {
803
+ case DXGI_MODE_ROTATION_ROTATE90:
804
+ case DXGI_MODE_ROTATION_ROTATE270:
805
+ return TRUE;
806
+ default:
807
+ return FALSE;
808
+ }
809
+ }
810
+
811
+ static int
812
+ D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer * renderer)
813
+ {
814
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
815
+ if (data->currentOffscreenRenderTargetView) {
816
+ return DXGI_MODE_ROTATION_IDENTITY;
817
+ } else {
818
+ return data->rotation;
819
+ }
820
+ }
821
+
822
+ static int
823
+ D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect, BOOL includeViewportOffset)
824
+ {
825
+ const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
826
+ switch (rotation) {
827
+ case DXGI_MODE_ROTATION_IDENTITY:
828
+ outRect->left = sdlRect->x;
829
+ outRect->right = sdlRect->x + sdlRect->w;
830
+ outRect->top = sdlRect->y;
831
+ outRect->bottom = sdlRect->y + sdlRect->h;
832
+ if (includeViewportOffset) {
833
+ outRect->left += renderer->viewport.x;
834
+ outRect->right += renderer->viewport.x;
835
+ outRect->top += renderer->viewport.y;
836
+ outRect->bottom += renderer->viewport.y;
837
+ }
838
+ break;
839
+ case DXGI_MODE_ROTATION_ROTATE270:
840
+ outRect->left = sdlRect->y;
841
+ outRect->right = sdlRect->y + sdlRect->h;
842
+ outRect->top = renderer->viewport.w - sdlRect->x - sdlRect->w;
843
+ outRect->bottom = renderer->viewport.w - sdlRect->x;
844
+ break;
845
+ case DXGI_MODE_ROTATION_ROTATE180:
846
+ outRect->left = renderer->viewport.w - sdlRect->x - sdlRect->w;
847
+ outRect->right = renderer->viewport.w - sdlRect->x;
848
+ outRect->top = renderer->viewport.h - sdlRect->y - sdlRect->h;
849
+ outRect->bottom = renderer->viewport.h - sdlRect->y;
850
+ break;
851
+ case DXGI_MODE_ROTATION_ROTATE90:
852
+ outRect->left = renderer->viewport.h - sdlRect->y - sdlRect->h;
853
+ outRect->right = renderer->viewport.h - sdlRect->y;
854
+ outRect->top = sdlRect->x;
855
+ outRect->bottom = sdlRect->x + sdlRect->h;
856
+ break;
857
+ default:
858
+ return SDL_SetError("The physical display is in an unknown or unsupported rotation");
859
+ }
860
+ return 0;
861
+ }
862
+
863
+ static HRESULT
864
+ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h)
865
+ {
866
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
867
+ #ifdef __WINRT__
868
+ IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
869
+ const BOOL usingXAML = (coreWindow == NULL);
870
+ #else
871
+ IUnknown *coreWindow = NULL;
872
+ const BOOL usingXAML = FALSE;
873
+ #endif
874
+ HRESULT result = S_OK;
875
+
876
+ /* Create a swap chain using the same adapter as the existing Direct3D device. */
877
+ DXGI_SWAP_CHAIN_DESC1 swapChainDesc;
878
+ SDL_zero(swapChainDesc);
879
+ swapChainDesc.Width = w;
880
+ swapChainDesc.Height = h;
881
+ swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; /* This is the most common swap chain format. */
882
+ swapChainDesc.Stereo = FALSE;
883
+ swapChainDesc.SampleDesc.Count = 1; /* Don't use multi-sampling. */
884
+ swapChainDesc.SampleDesc.Quality = 0;
885
+ swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
886
+ swapChainDesc.BufferCount = 2; /* Use double-buffering to minimize latency. */
887
+ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
888
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH; /* On phone, only stretch and aspect-ratio stretch scaling are allowed. */
889
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; /* On phone, no swap effects are supported. */
890
+ /* TODO, WinRT: see if Win 8.x DXGI_SWAP_CHAIN_DESC1 settings are available on Windows Phone 8.1, and if there's any advantage to having them on */
891
+ #else
892
+ if (usingXAML) {
893
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
894
+ } else {
895
+ swapChainDesc.Scaling = DXGI_SCALING_NONE;
896
+ }
897
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; /* All Windows Store apps must use this SwapEffect. */
898
+ #endif
899
+ swapChainDesc.Flags = 0;
900
+
901
+ if (coreWindow) {
902
+ result = IDXGIFactory2_CreateSwapChainForCoreWindow(data->dxgiFactory,
903
+ (IUnknown *)data->d3dDevice,
904
+ coreWindow,
905
+ &swapChainDesc,
906
+ NULL, /* Allow on all displays. */
907
+ &data->swapChain
908
+ );
909
+ if (FAILED(result)) {
910
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForCoreWindow"), result);
911
+ goto done;
912
+ }
913
+ } else if (usingXAML) {
914
+ result = IDXGIFactory2_CreateSwapChainForComposition(data->dxgiFactory,
915
+ (IUnknown *)data->d3dDevice,
916
+ &swapChainDesc,
917
+ NULL,
918
+ &data->swapChain);
919
+ if (FAILED(result)) {
920
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForComposition"), result);
921
+ goto done;
922
+ }
923
+
924
+ #if WINAPI_FAMILY == WINAPI_FAMILY_APP
925
+ result = ISwapChainBackgroundPanelNative_SetSwapChain(WINRT_GlobalSwapChainBackgroundPanelNative, (IDXGISwapChain *) data->swapChain);
926
+ if (FAILED(result)) {
927
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ISwapChainBackgroundPanelNative::SetSwapChain"), result);
928
+ goto done;
929
+ }
930
+ #else
931
+ SDL_SetError(SDL_COMPOSE_ERROR("XAML support is not yet available for Windows Phone"));
932
+ result = E_FAIL;
933
+ goto done;
934
+ #endif
935
+ } else {
936
+ #ifdef __WIN32__
937
+ SDL_SysWMinfo windowinfo;
938
+ SDL_VERSION(&windowinfo.version);
939
+ SDL_GetWindowWMInfo(renderer->window, &windowinfo);
940
+
941
+ result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
942
+ (IUnknown *)data->d3dDevice,
943
+ windowinfo.info.win.window,
944
+ &swapChainDesc,
945
+ NULL,
946
+ NULL, /* Allow on all displays. */
947
+ &data->swapChain
948
+ );
949
+ if (FAILED(result)) {
950
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForHwnd"), result);
951
+ goto done;
952
+ }
953
+
954
+ IDXGIFactory_MakeWindowAssociation(data->dxgiFactory, windowinfo.info.win.window, DXGI_MWA_NO_WINDOW_CHANGES);
955
+ #else
956
+ SDL_SetError(__FUNCTION__", Unable to find something to attach a swap chain to");
957
+ goto done;
958
+ #endif /* ifdef __WIN32__ / else */
959
+ }
960
+ data->swapEffect = swapChainDesc.SwapEffect;
961
+
962
+ done:
963
+ SAFE_RELEASE(coreWindow);
964
+ return result;
965
+ }
966
+
967
+
968
+ /* Initialize all resources that change when the window's size changes. */
969
+ static HRESULT
970
+ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
971
+ {
972
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
973
+ ID3D11Texture2D *backBuffer = NULL;
974
+ HRESULT result = S_OK;
975
+ int w, h;
976
+
977
+ /* Release the previous render target view */
978
+ D3D11_ReleaseMainRenderTargetView(renderer);
979
+
980
+ /* The width and height of the swap chain must be based on the display's
981
+ * non-rotated size.
982
+ */
983
+ SDL_GetWindowSize(renderer->window, &w, &h);
984
+ data->rotation = D3D11_GetCurrentRotation();
985
+ /* SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); */
986
+ if (D3D11_IsDisplayRotated90Degrees(data->rotation)) {
987
+ int tmp = w;
988
+ w = h;
989
+ h = tmp;
990
+ }
991
+
992
+ if (data->swapChain) {
993
+ /* IDXGISwapChain::ResizeBuffers is not available on Windows Phone 8. */
994
+ #if !defined(__WINRT__) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
995
+ /* If the swap chain already exists, resize it. */
996
+ result = IDXGISwapChain_ResizeBuffers(data->swapChain,
997
+ 0,
998
+ w, h,
999
+ DXGI_FORMAT_UNKNOWN,
1000
+ 0
1001
+ );
1002
+ if (result == DXGI_ERROR_DEVICE_REMOVED) {
1003
+ /* If the device was removed for any reason, a new device and swap chain will need to be created. */
1004
+ D3D11_HandleDeviceLost(renderer);
1005
+
1006
+ /* Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method
1007
+ * and correctly set up the new device.
1008
+ */
1009
+ goto done;
1010
+ } else if (FAILED(result)) {
1011
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::ResizeBuffers"), result);
1012
+ goto done;
1013
+ }
1014
+ #endif
1015
+ } else {
1016
+ result = D3D11_CreateSwapChain(renderer, w, h);
1017
+ if (FAILED(result)) {
1018
+ goto done;
1019
+ }
1020
+ }
1021
+
1022
+ #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
1023
+ /* Set the proper rotation for the swap chain.
1024
+ *
1025
+ * To note, the call for this, IDXGISwapChain1::SetRotation, is not necessary
1026
+ * on Windows Phone 8.0, nor is it supported there.
1027
+ *
1028
+ * IDXGISwapChain1::SetRotation does seem to be available on Windows Phone 8.1,
1029
+ * however I've yet to find a way to make it work. It might have something to
1030
+ * do with IDXGISwapChain::ResizeBuffers appearing to not being available on
1031
+ * Windows Phone 8.1 (it wasn't on Windows Phone 8.0), but I'm not 100% sure of this.
1032
+ * The call doesn't appear to be entirely necessary though, and is a performance-related
1033
+ * call, at least according to the following page on MSDN:
1034
+ * http://code.msdn.microsoft.com/windowsapps/DXGI-swap-chain-rotation-21d13d71
1035
+ * -- David L.
1036
+ *
1037
+ * TODO, WinRT: reexamine the docs for IDXGISwapChain1::SetRotation, see if might be available, usable, and prudent-to-call on WinPhone 8.1
1038
+ */
1039
+ if (data->swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) {
1040
+ result = IDXGISwapChain1_SetRotation(data->swapChain, data->rotation);
1041
+ if (FAILED(result)) {
1042
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::SetRotation"), result);
1043
+ goto done;
1044
+ }
1045
+ }
1046
+ #endif
1047
+
1048
+ result = IDXGISwapChain_GetBuffer(data->swapChain,
1049
+ 0,
1050
+ &SDL_IID_ID3D11Texture2D,
1051
+ (void **)&backBuffer
1052
+ );
1053
+ if (FAILED(result)) {
1054
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::GetBuffer [back-buffer]"), result);
1055
+ goto done;
1056
+ }
1057
+
1058
+ /* Create a render target view of the swap chain back buffer. */
1059
+ result = ID3D11Device_CreateRenderTargetView(data->d3dDevice,
1060
+ (ID3D11Resource *)backBuffer,
1061
+ NULL,
1062
+ &data->mainRenderTargetView
1063
+ );
1064
+ if (FAILED(result)) {
1065
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateRenderTargetView"), result);
1066
+ goto done;
1067
+ }
1068
+
1069
+ if (D3D11_UpdateViewport(renderer) != 0) {
1070
+ /* D3D11_UpdateViewport will set the SDL error if it fails. */
1071
+ result = E_FAIL;
1072
+ goto done;
1073
+ }
1074
+
1075
+ done:
1076
+ SAFE_RELEASE(backBuffer);
1077
+ return result;
1078
+ }
1079
+
1080
+ /* This method is called when the window's size changes. */
1081
+ static HRESULT
1082
+ D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer)
1083
+ {
1084
+ return D3D11_CreateWindowSizeDependentResources(renderer);
1085
+ }
1086
+
1087
+ HRESULT
1088
+ D3D11_HandleDeviceLost(SDL_Renderer * renderer)
1089
+ {
1090
+ HRESULT result = S_OK;
1091
+
1092
+ D3D11_ReleaseAll(renderer);
1093
+
1094
+ result = D3D11_CreateDeviceResources(renderer);
1095
+ if (FAILED(result)) {
1096
+ /* D3D11_CreateDeviceResources will set the SDL error */
1097
+ return result;
1098
+ }
1099
+
1100
+ result = D3D11_UpdateForWindowSizeChange(renderer);
1101
+ if (FAILED(result)) {
1102
+ /* D3D11_UpdateForWindowSizeChange will set the SDL error */
1103
+ return result;
1104
+ }
1105
+
1106
+ /* Let the application know that the device has been reset */
1107
+ {
1108
+ SDL_Event event;
1109
+ event.type = SDL_RENDER_DEVICE_RESET;
1110
+ SDL_PushEvent(&event);
1111
+ }
1112
+
1113
+ return S_OK;
1114
+ }
1115
+
1116
+ void
1117
+ D3D11_Trim(SDL_Renderer * renderer)
1118
+ {
1119
+ #ifdef __WINRT__
1120
+ #if NTDDI_VERSION > NTDDI_WIN8
1121
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
1122
+ HRESULT result = S_OK;
1123
+ IDXGIDevice3 *dxgiDevice = NULL;
1124
+
1125
+ result = ID3D11Device_QueryInterface(data->d3dDevice, &SDL_IID_IDXGIDevice3, &dxgiDevice);
1126
+ if (FAILED(result)) {
1127
+ //WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice3", result);
1128
+ return;
1129
+ }
1130
+
1131
+ IDXGIDevice3_Trim(dxgiDevice);
1132
+ SAFE_RELEASE(dxgiDevice);
1133
+ #endif
1134
+ #endif
1135
+ }
1136
+
1137
+ static void
1138
+ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
1139
+ {
1140
+ if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
1141
+ D3D11_UpdateForWindowSizeChange(renderer);
1142
+ }
1143
+ }
1144
+
1145
+ static SDL_bool
1146
+ D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
1147
+ {
1148
+ SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
1149
+ SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
1150
+ SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
1151
+ SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
1152
+ SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
1153
+ SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
1154
+
1155
+ if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) ||
1156
+ !GetBlendEquation(colorOperation) ||
1157
+ !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) ||
1158
+ !GetBlendEquation(alphaOperation)) {
1159
+ return SDL_FALSE;
1160
+ }
1161
+ return SDL_TRUE;
1162
+ }
1163
+
1164
+ static int
1165
+ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
1166
+ {
1167
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
1168
+ D3D11_TextureData *textureData;
1169
+ HRESULT result;
1170
+ DXGI_FORMAT textureFormat = SDLPixelFormatToDXGIFormat(texture->format);
1171
+ D3D11_TEXTURE2D_DESC textureDesc;
1172
+ D3D11_SHADER_RESOURCE_VIEW_DESC resourceViewDesc;
1173
+
1174
+ if (textureFormat == DXGI_FORMAT_UNKNOWN) {
1175
+ return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified",
1176
+ __FUNCTION__, texture->format);
1177
+ }
1178
+
1179
+ textureData = (D3D11_TextureData*) SDL_calloc(1, sizeof(*textureData));
1180
+ if (!textureData) {
1181
+ SDL_OutOfMemory();
1182
+ return -1;
1183
+ }
1184
+ textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
1185
+
1186
+ texture->driverdata = textureData;
1187
+
1188
+ SDL_zero(textureDesc);
1189
+ textureDesc.Width = texture->w;
1190
+ textureDesc.Height = texture->h;
1191
+ textureDesc.MipLevels = 1;
1192
+ textureDesc.ArraySize = 1;
1193
+ textureDesc.Format = textureFormat;
1194
+ textureDesc.SampleDesc.Count = 1;
1195
+ textureDesc.SampleDesc.Quality = 0;
1196
+ textureDesc.MiscFlags = 0;
1197
+
1198
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
1199
+ textureDesc.Usage = D3D11_USAGE_DYNAMIC;
1200
+ textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
1201
+ } else {
1202
+ textureDesc.Usage = D3D11_USAGE_DEFAULT;
1203
+ textureDesc.CPUAccessFlags = 0;
1204
+ }
1205
+
1206
+ if (texture->access == SDL_TEXTUREACCESS_TARGET) {
1207
+ textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
1208
+ } else {
1209
+ textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
1210
+ }
1211
+
1212
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
1213
+ &textureDesc,
1214
+ NULL,
1215
+ &textureData->mainTexture
1216
+ );
1217
+ if (FAILED(result)) {
1218
+ D3D11_DestroyTexture(renderer, texture);
1219
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
1220
+ return -1;
1221
+ }
1222
+
1223
+ if (texture->format == SDL_PIXELFORMAT_YV12 ||
1224
+ texture->format == SDL_PIXELFORMAT_IYUV) {
1225
+ textureData->yuv = SDL_TRUE;
1226
+
1227
+ textureDesc.Width = (textureDesc.Width + 1) / 2;
1228
+ textureDesc.Height = (textureDesc.Height + 1) / 2;
1229
+
1230
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
1231
+ &textureDesc,
1232
+ NULL,
1233
+ &textureData->mainTextureU
1234
+ );
1235
+ if (FAILED(result)) {
1236
+ D3D11_DestroyTexture(renderer, texture);
1237
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
1238
+ return -1;
1239
+ }
1240
+
1241
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
1242
+ &textureDesc,
1243
+ NULL,
1244
+ &textureData->mainTextureV
1245
+ );
1246
+ if (FAILED(result)) {
1247
+ D3D11_DestroyTexture(renderer, texture);
1248
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
1249
+ return -1;
1250
+ }
1251
+ }
1252
+
1253
+ if (texture->format == SDL_PIXELFORMAT_NV12 ||
1254
+ texture->format == SDL_PIXELFORMAT_NV21) {
1255
+ D3D11_TEXTURE2D_DESC nvTextureDesc = textureDesc;
1256
+
1257
+ textureData->nv12 = SDL_TRUE;
1258
+
1259
+ nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM;
1260
+ nvTextureDesc.Width = (textureDesc.Width + 1) / 2;
1261
+ nvTextureDesc.Height = (textureDesc.Height + 1) / 2;
1262
+
1263
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
1264
+ &nvTextureDesc,
1265
+ NULL,
1266
+ &textureData->mainTextureNV
1267
+ );
1268
+ if (FAILED(result)) {
1269
+ D3D11_DestroyTexture(renderer, texture);
1270
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
1271
+ return -1;
1272
+ }
1273
+ }
1274
+
1275
+ resourceViewDesc.Format = textureDesc.Format;
1276
+ resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
1277
+ resourceViewDesc.Texture2D.MostDetailedMip = 0;
1278
+ resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels;
1279
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
1280
+ (ID3D11Resource *)textureData->mainTexture,
1281
+ &resourceViewDesc,
1282
+ &textureData->mainTextureResourceView
1283
+ );
1284
+ if (FAILED(result)) {
1285
+ D3D11_DestroyTexture(renderer, texture);
1286
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
1287
+ return -1;
1288
+ }
1289
+
1290
+ if (textureData->yuv) {
1291
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
1292
+ (ID3D11Resource *)textureData->mainTextureU,
1293
+ &resourceViewDesc,
1294
+ &textureData->mainTextureResourceViewU
1295
+ );
1296
+ if (FAILED(result)) {
1297
+ D3D11_DestroyTexture(renderer, texture);
1298
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
1299
+ return -1;
1300
+ }
1301
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
1302
+ (ID3D11Resource *)textureData->mainTextureV,
1303
+ &resourceViewDesc,
1304
+ &textureData->mainTextureResourceViewV
1305
+ );
1306
+ if (FAILED(result)) {
1307
+ D3D11_DestroyTexture(renderer, texture);
1308
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
1309
+ return -1;
1310
+ }
1311
+ }
1312
+
1313
+ if (textureData->nv12) {
1314
+ D3D11_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc;
1315
+
1316
+ nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM;
1317
+
1318
+ result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
1319
+ (ID3D11Resource *)textureData->mainTextureNV,
1320
+ &nvResourceViewDesc,
1321
+ &textureData->mainTextureResourceViewNV
1322
+ );
1323
+ if (FAILED(result)) {
1324
+ D3D11_DestroyTexture(renderer, texture);
1325
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
1326
+ return -1;
1327
+ }
1328
+ }
1329
+
1330
+ if (texture->access & SDL_TEXTUREACCESS_TARGET) {
1331
+ D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
1332
+ renderTargetViewDesc.Format = textureDesc.Format;
1333
+ renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
1334
+ renderTargetViewDesc.Texture2D.MipSlice = 0;
1335
+
1336
+ result = ID3D11Device_CreateRenderTargetView(rendererData->d3dDevice,
1337
+ (ID3D11Resource *)textureData->mainTexture,
1338
+ &renderTargetViewDesc,
1339
+ &textureData->mainTextureRenderTargetView);
1340
+ if (FAILED(result)) {
1341
+ D3D11_DestroyTexture(renderer, texture);
1342
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result);
1343
+ return -1;
1344
+ }
1345
+ }
1346
+
1347
+ return 0;
1348
+ }
1349
+
1350
+ static void
1351
+ D3D11_DestroyTexture(SDL_Renderer * renderer,
1352
+ SDL_Texture * texture)
1353
+ {
1354
+ D3D11_TextureData *data = (D3D11_TextureData *)texture->driverdata;
1355
+
1356
+ if (!data) {
1357
+ return;
1358
+ }
1359
+
1360
+ SAFE_RELEASE(data->mainTexture);
1361
+ SAFE_RELEASE(data->mainTextureResourceView);
1362
+ SAFE_RELEASE(data->mainTextureRenderTargetView);
1363
+ SAFE_RELEASE(data->stagingTexture);
1364
+ SAFE_RELEASE(data->mainTextureU);
1365
+ SAFE_RELEASE(data->mainTextureResourceViewU);
1366
+ SAFE_RELEASE(data->mainTextureV);
1367
+ SAFE_RELEASE(data->mainTextureResourceViewV);
1368
+ SDL_free(data->pixels);
1369
+ SDL_free(data);
1370
+ texture->driverdata = NULL;
1371
+ }
1372
+
1373
+ static int
1374
+ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch)
1375
+ {
1376
+ ID3D11Texture2D *stagingTexture;
1377
+ const Uint8 *src;
1378
+ Uint8 *dst;
1379
+ int row;
1380
+ UINT length;
1381
+ HRESULT result;
1382
+ D3D11_TEXTURE2D_DESC stagingTextureDesc;
1383
+ D3D11_MAPPED_SUBRESOURCE textureMemory;
1384
+
1385
+ /* Create a 'staging' texture, which will be used to write to a portion of the main texture. */
1386
+ ID3D11Texture2D_GetDesc(texture, &stagingTextureDesc);
1387
+ stagingTextureDesc.Width = w;
1388
+ stagingTextureDesc.Height = h;
1389
+ stagingTextureDesc.BindFlags = 0;
1390
+ stagingTextureDesc.MiscFlags = 0;
1391
+ stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
1392
+ stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
1393
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
1394
+ &stagingTextureDesc,
1395
+ NULL,
1396
+ &stagingTexture);
1397
+ if (FAILED(result)) {
1398
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
1399
+ return -1;
1400
+ }
1401
+
1402
+ /* Get a write-only pointer to data in the staging texture: */
1403
+ result = ID3D11DeviceContext_Map(rendererData->d3dContext,
1404
+ (ID3D11Resource *)stagingTexture,
1405
+ 0,
1406
+ D3D11_MAP_WRITE,
1407
+ 0,
1408
+ &textureMemory
1409
+ );
1410
+ if (FAILED(result)) {
1411
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
1412
+ SAFE_RELEASE(stagingTexture);
1413
+ return -1;
1414
+ }
1415
+
1416
+ src = (const Uint8 *)pixels;
1417
+ dst = textureMemory.pData;
1418
+ length = w * bpp;
1419
+ if (length == pitch && length == textureMemory.RowPitch) {
1420
+ SDL_memcpy(dst, src, length*h);
1421
+ } else {
1422
+ if (length > (UINT)pitch) {
1423
+ length = pitch;
1424
+ }
1425
+ if (length > textureMemory.RowPitch) {
1426
+ length = textureMemory.RowPitch;
1427
+ }
1428
+ for (row = 0; row < h; ++row) {
1429
+ SDL_memcpy(dst, src, length);
1430
+ src += pitch;
1431
+ dst += textureMemory.RowPitch;
1432
+ }
1433
+ }
1434
+
1435
+ /* Commit the pixel buffer's changes back to the staging texture: */
1436
+ ID3D11DeviceContext_Unmap(rendererData->d3dContext,
1437
+ (ID3D11Resource *)stagingTexture,
1438
+ 0);
1439
+
1440
+ /* Copy the staging texture's contents back to the texture: */
1441
+ ID3D11DeviceContext_CopySubresourceRegion(rendererData->d3dContext,
1442
+ (ID3D11Resource *)texture,
1443
+ 0,
1444
+ x,
1445
+ y,
1446
+ 0,
1447
+ (ID3D11Resource *)stagingTexture,
1448
+ 0,
1449
+ NULL);
1450
+
1451
+ SAFE_RELEASE(stagingTexture);
1452
+
1453
+ return 0;
1454
+ }
1455
+
1456
+ static int
1457
+ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
1458
+ const SDL_Rect * rect, const void * srcPixels,
1459
+ int srcPitch)
1460
+ {
1461
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
1462
+ D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
1463
+
1464
+ if (!textureData) {
1465
+ SDL_SetError("Texture is not currently available");
1466
+ return -1;
1467
+ }
1468
+
1469
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) {
1470
+ return -1;
1471
+ }
1472
+
1473
+ if (textureData->yuv) {
1474
+ /* Skip to the correct offset into the next texture */
1475
+ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
1476
+
1477
+ if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) {
1478
+ return -1;
1479
+ }
1480
+
1481
+ /* Skip to the correct offset into the next texture */
1482
+ srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2));
1483
+ if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) {
1484
+ return -1;
1485
+ }
1486
+ }
1487
+
1488
+ if (textureData->nv12) {
1489
+ /* Skip to the correct offset into the next texture */
1490
+ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
1491
+
1492
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2)) < 0) {
1493
+ return -1;
1494
+ }
1495
+ }
1496
+ return 0;
1497
+ }
1498
+
1499
+ static int
1500
+ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
1501
+ const SDL_Rect * rect,
1502
+ const Uint8 *Yplane, int Ypitch,
1503
+ const Uint8 *Uplane, int Upitch,
1504
+ const Uint8 *Vplane, int Vpitch)
1505
+ {
1506
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
1507
+ D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
1508
+
1509
+ if (!textureData) {
1510
+ SDL_SetError("Texture is not currently available");
1511
+ return -1;
1512
+ }
1513
+
1514
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
1515
+ return -1;
1516
+ }
1517
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) {
1518
+ return -1;
1519
+ }
1520
+ if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) {
1521
+ return -1;
1522
+ }
1523
+ return 0;
1524
+ }
1525
+
1526
+ static int
1527
+ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
1528
+ const SDL_Rect * rect, void **pixels, int *pitch)
1529
+ {
1530
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
1531
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
1532
+ HRESULT result = S_OK;
1533
+ D3D11_TEXTURE2D_DESC stagingTextureDesc;
1534
+ D3D11_MAPPED_SUBRESOURCE textureMemory;
1535
+
1536
+ if (!textureData) {
1537
+ SDL_SetError("Texture is not currently available");
1538
+ return -1;
1539
+ }
1540
+
1541
+ if (textureData->yuv || textureData->nv12) {
1542
+ /* It's more efficient to upload directly... */
1543
+ if (!textureData->pixels) {
1544
+ textureData->pitch = texture->w;
1545
+ textureData->pixels = (Uint8 *)SDL_malloc((texture->h * textureData->pitch * 3) / 2);
1546
+ if (!textureData->pixels) {
1547
+ return SDL_OutOfMemory();
1548
+ }
1549
+ }
1550
+ textureData->locked_rect = *rect;
1551
+ *pixels =
1552
+ (void *)((Uint8 *)textureData->pixels + rect->y * textureData->pitch +
1553
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
1554
+ *pitch = textureData->pitch;
1555
+ return 0;
1556
+ }
1557
+
1558
+ if (textureData->stagingTexture) {
1559
+ return SDL_SetError("texture is already locked");
1560
+ }
1561
+
1562
+ /* Create a 'staging' texture, which will be used to write to a portion
1563
+ * of the main texture. This is necessary, as Direct3D 11.1 does not
1564
+ * have the ability to write a CPU-bound pixel buffer to a rectangular
1565
+ * subrect of a texture. Direct3D 11.1 can, however, write a pixel
1566
+ * buffer to an entire texture, hence the use of a staging texture.
1567
+ *
1568
+ * TODO, WinRT: consider avoiding the use of a staging texture in D3D11_LockTexture if/when the entire texture is being updated
1569
+ */
1570
+ ID3D11Texture2D_GetDesc(textureData->mainTexture, &stagingTextureDesc);
1571
+ stagingTextureDesc.Width = rect->w;
1572
+ stagingTextureDesc.Height = rect->h;
1573
+ stagingTextureDesc.BindFlags = 0;
1574
+ stagingTextureDesc.MiscFlags = 0;
1575
+ stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
1576
+ stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
1577
+ result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
1578
+ &stagingTextureDesc,
1579
+ NULL,
1580
+ &textureData->stagingTexture);
1581
+ if (FAILED(result)) {
1582
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
1583
+ return -1;
1584
+ }
1585
+
1586
+ /* Get a write-only pointer to data in the staging texture: */
1587
+ result = ID3D11DeviceContext_Map(rendererData->d3dContext,
1588
+ (ID3D11Resource *)textureData->stagingTexture,
1589
+ 0,
1590
+ D3D11_MAP_WRITE,
1591
+ 0,
1592
+ &textureMemory
1593
+ );
1594
+ if (FAILED(result)) {
1595
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
1596
+ SAFE_RELEASE(textureData->stagingTexture);
1597
+ return -1;
1598
+ }
1599
+
1600
+ /* Make note of where the staging texture will be written to
1601
+ * (on a call to SDL_UnlockTexture):
1602
+ */
1603
+ textureData->lockedTexturePositionX = rect->x;
1604
+ textureData->lockedTexturePositionY = rect->y;
1605
+
1606
+ /* Make sure the caller has information on the texture's pixel buffer,
1607
+ * then return:
1608
+ */
1609
+ *pixels = textureMemory.pData;
1610
+ *pitch = textureMemory.RowPitch;
1611
+ return 0;
1612
+ }
1613
+
1614
+ static void
1615
+ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
1616
+ {
1617
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
1618
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
1619
+
1620
+ if (!textureData) {
1621
+ return;
1622
+ }
1623
+
1624
+ if (textureData->yuv || textureData->nv12) {
1625
+ const SDL_Rect *rect = &textureData->locked_rect;
1626
+ void *pixels =
1627
+ (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch +
1628
+ rect->x * SDL_BYTESPERPIXEL(texture->format));
1629
+ D3D11_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch);
1630
+ return;
1631
+ }
1632
+
1633
+ /* Commit the pixel buffer's changes back to the staging texture: */
1634
+ ID3D11DeviceContext_Unmap(rendererData->d3dContext,
1635
+ (ID3D11Resource *)textureData->stagingTexture,
1636
+ 0);
1637
+
1638
+ /* Copy the staging texture's contents back to the main texture: */
1639
+ ID3D11DeviceContext_CopySubresourceRegion(rendererData->d3dContext,
1640
+ (ID3D11Resource *)textureData->mainTexture,
1641
+ 0,
1642
+ textureData->lockedTexturePositionX,
1643
+ textureData->lockedTexturePositionY,
1644
+ 0,
1645
+ (ID3D11Resource *)textureData->stagingTexture,
1646
+ 0,
1647
+ NULL);
1648
+
1649
+ SAFE_RELEASE(textureData->stagingTexture);
1650
+ }
1651
+
1652
+ static int
1653
+ D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
1654
+ {
1655
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
1656
+ D3D11_TextureData *textureData = NULL;
1657
+
1658
+ if (texture == NULL) {
1659
+ rendererData->currentOffscreenRenderTargetView = NULL;
1660
+ return 0;
1661
+ }
1662
+
1663
+ textureData = (D3D11_TextureData *) texture->driverdata;
1664
+
1665
+ if (!textureData->mainTextureRenderTargetView) {
1666
+ return SDL_SetError("specified texture is not a render target");
1667
+ }
1668
+
1669
+ rendererData->currentOffscreenRenderTargetView = textureData->mainTextureRenderTargetView;
1670
+
1671
+ return 0;
1672
+ }
1673
+
1674
+ static void
1675
+ D3D11_SetModelMatrix(SDL_Renderer *renderer, const Float4X4 *matrix)
1676
+ {
1677
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
1678
+
1679
+ if (matrix) {
1680
+ data->vertexShaderConstantsData.model = *matrix;
1681
+ } else {
1682
+ data->vertexShaderConstantsData.model = MatrixIdentity();
1683
+ }
1684
+
1685
+ ID3D11DeviceContext_UpdateSubresource(data->d3dContext,
1686
+ (ID3D11Resource *)data->vertexShaderConstants,
1687
+ 0,
1688
+ NULL,
1689
+ &data->vertexShaderConstantsData,
1690
+ 0,
1691
+ 0
1692
+ );
1693
+ }
1694
+
1695
+ static int
1696
+ D3D11_UpdateViewport(SDL_Renderer * renderer)
1697
+ {
1698
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
1699
+ Float4X4 projection;
1700
+ Float4X4 view;
1701
+ SDL_FRect orientationAlignedViewport;
1702
+ BOOL swapDimensions;
1703
+ D3D11_VIEWPORT viewport;
1704
+ const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
1705
+
1706
+ if (renderer->viewport.w == 0 || renderer->viewport.h == 0) {
1707
+ /* If the viewport is empty, assume that it is because
1708
+ * SDL_CreateRenderer is calling it, and will call it again later
1709
+ * with a non-empty viewport.
1710
+ */
1711
+ /* SDL_Log("%s, no viewport was set!\n", __FUNCTION__); */
1712
+ return 0;
1713
+ }
1714
+
1715
+ /* Make sure the SDL viewport gets rotated to that of the physical display's rotation.
1716
+ * Keep in mind here that the Y-axis will be been inverted (from Direct3D's
1717
+ * default coordinate system) so rotations will be done in the opposite
1718
+ * direction of the DXGI_MODE_ROTATION enumeration.
1719
+ */
1720
+ switch (rotation) {
1721
+ case DXGI_MODE_ROTATION_IDENTITY:
1722
+ projection = MatrixIdentity();
1723
+ break;
1724
+ case DXGI_MODE_ROTATION_ROTATE270:
1725
+ projection = MatrixRotationZ(SDL_static_cast(float, M_PI * 0.5f));
1726
+ break;
1727
+ case DXGI_MODE_ROTATION_ROTATE180:
1728
+ projection = MatrixRotationZ(SDL_static_cast(float, M_PI));
1729
+ break;
1730
+ case DXGI_MODE_ROTATION_ROTATE90:
1731
+ projection = MatrixRotationZ(SDL_static_cast(float, -M_PI * 0.5f));
1732
+ break;
1733
+ default:
1734
+ return SDL_SetError("An unknown DisplayOrientation is being used");
1735
+ }
1736
+
1737
+ /* Update the view matrix */
1738
+ view.m[0][0] = 2.0f / renderer->viewport.w;
1739
+ view.m[0][1] = 0.0f;
1740
+ view.m[0][2] = 0.0f;
1741
+ view.m[0][3] = 0.0f;
1742
+ view.m[1][0] = 0.0f;
1743
+ view.m[1][1] = -2.0f / renderer->viewport.h;
1744
+ view.m[1][2] = 0.0f;
1745
+ view.m[1][3] = 0.0f;
1746
+ view.m[2][0] = 0.0f;
1747
+ view.m[2][1] = 0.0f;
1748
+ view.m[2][2] = 1.0f;
1749
+ view.m[2][3] = 0.0f;
1750
+ view.m[3][0] = -1.0f;
1751
+ view.m[3][1] = 1.0f;
1752
+ view.m[3][2] = 0.0f;
1753
+ view.m[3][3] = 1.0f;
1754
+
1755
+ /* Combine the projection + view matrix together now, as both only get
1756
+ * set here (as of this writing, on Dec 26, 2013). When done, store it
1757
+ * for eventual transfer to the GPU.
1758
+ */
1759
+ data->vertexShaderConstantsData.projectionAndView = MatrixMultiply(
1760
+ view,
1761
+ projection);
1762
+
1763
+ /* Reset the model matrix */
1764
+ D3D11_SetModelMatrix(renderer, NULL);
1765
+
1766
+ /* Update the Direct3D viewport, which seems to be aligned to the
1767
+ * swap buffer's coordinate space, which is always in either
1768
+ * a landscape mode, for all Windows 8/RT devices, or a portrait mode,
1769
+ * for Windows Phone devices.
1770
+ */
1771
+ swapDimensions = D3D11_IsDisplayRotated90Degrees(rotation);
1772
+ if (swapDimensions) {
1773
+ orientationAlignedViewport.x = (float) renderer->viewport.y;
1774
+ orientationAlignedViewport.y = (float) renderer->viewport.x;
1775
+ orientationAlignedViewport.w = (float) renderer->viewport.h;
1776
+ orientationAlignedViewport.h = (float) renderer->viewport.w;
1777
+ } else {
1778
+ orientationAlignedViewport.x = (float) renderer->viewport.x;
1779
+ orientationAlignedViewport.y = (float) renderer->viewport.y;
1780
+ orientationAlignedViewport.w = (float) renderer->viewport.w;
1781
+ orientationAlignedViewport.h = (float) renderer->viewport.h;
1782
+ }
1783
+ /* TODO, WinRT: get custom viewports working with non-Landscape modes (Portrait, PortraitFlipped, and LandscapeFlipped) */
1784
+
1785
+ viewport.TopLeftX = orientationAlignedViewport.x;
1786
+ viewport.TopLeftY = orientationAlignedViewport.y;
1787
+ viewport.Width = orientationAlignedViewport.w;
1788
+ viewport.Height = orientationAlignedViewport.h;
1789
+ viewport.MinDepth = 0.0f;
1790
+ viewport.MaxDepth = 1.0f;
1791
+ /* SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, viewport.TopLeftX, viewport.TopLeftY, viewport.Width, viewport.Height); */
1792
+ ID3D11DeviceContext_RSSetViewports(data->d3dContext, 1, &viewport);
1793
+
1794
+ return 0;
1795
+ }
1796
+
1797
+ static int
1798
+ D3D11_UpdateClipRect(SDL_Renderer * renderer)
1799
+ {
1800
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
1801
+
1802
+ if (!renderer->clipping_enabled) {
1803
+ ID3D11DeviceContext_RSSetScissorRects(data->d3dContext, 0, NULL);
1804
+ } else {
1805
+ D3D11_RECT scissorRect;
1806
+ if (D3D11_GetViewportAlignedD3DRect(renderer, &renderer->clip_rect, &scissorRect, TRUE) != 0) {
1807
+ /* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
1808
+ return -1;
1809
+ }
1810
+ ID3D11DeviceContext_RSSetScissorRects(data->d3dContext, 1, &scissorRect);
1811
+ }
1812
+
1813
+ return 0;
1814
+ }
1815
+
1816
+ static void
1817
+ D3D11_ReleaseMainRenderTargetView(SDL_Renderer * renderer)
1818
+ {
1819
+ D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
1820
+ ID3D11DeviceContext_OMSetRenderTargets(data->d3dContext, 0, NULL, NULL);
1821
+ SAFE_RELEASE(data->mainRenderTargetView);
1822
+ }
1823
+
1824
+ static ID3D11RenderTargetView *
1825
+ D3D11_GetCurrentRenderTargetView(SDL_Renderer * renderer)
1826
+ {
1827
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
1828
+ if (data->currentOffscreenRenderTargetView) {
1829
+ return data->currentOffscreenRenderTargetView;
1830
+ } else {
1831
+ return data->mainRenderTargetView;
1832
+ }
1833
+ }
1834
+
1835
+ static int
1836
+ D3D11_RenderClear(SDL_Renderer * renderer)
1837
+ {
1838
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
1839
+ const float colorRGBA[] = {
1840
+ (renderer->r / 255.0f),
1841
+ (renderer->g / 255.0f),
1842
+ (renderer->b / 255.0f),
1843
+ (renderer->a / 255.0f)
1844
+ };
1845
+ ID3D11DeviceContext_ClearRenderTargetView(data->d3dContext,
1846
+ D3D11_GetCurrentRenderTargetView(renderer),
1847
+ colorRGBA
1848
+ );
1849
+ return 0;
1850
+ }
1851
+
1852
+ static int
1853
+ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer,
1854
+ const void * vertexData, size_t dataSizeInBytes)
1855
+ {
1856
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
1857
+ D3D11_BUFFER_DESC vertexBufferDesc;
1858
+ HRESULT result = S_OK;
1859
+ D3D11_SUBRESOURCE_DATA vertexBufferData;
1860
+ const UINT stride = sizeof(VertexPositionColor);
1861
+ const UINT offset = 0;
1862
+
1863
+ if (rendererData->vertexBuffer) {
1864
+ ID3D11Buffer_GetDesc(rendererData->vertexBuffer, &vertexBufferDesc);
1865
+ } else {
1866
+ SDL_zero(vertexBufferDesc);
1867
+ }
1868
+
1869
+ if (rendererData->vertexBuffer && vertexBufferDesc.ByteWidth >= dataSizeInBytes) {
1870
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
1871
+ result = ID3D11DeviceContext_Map(rendererData->d3dContext,
1872
+ (ID3D11Resource *)rendererData->vertexBuffer,
1873
+ 0,
1874
+ D3D11_MAP_WRITE_DISCARD,
1875
+ 0,
1876
+ &mappedResource
1877
+ );
1878
+ if (FAILED(result)) {
1879
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result);
1880
+ return -1;
1881
+ }
1882
+ SDL_memcpy(mappedResource.pData, vertexData, dataSizeInBytes);
1883
+ ID3D11DeviceContext_Unmap(rendererData->d3dContext, (ID3D11Resource *)rendererData->vertexBuffer, 0);
1884
+ } else {
1885
+ SAFE_RELEASE(rendererData->vertexBuffer);
1886
+
1887
+ vertexBufferDesc.ByteWidth = (UINT) dataSizeInBytes;
1888
+ vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
1889
+ vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
1890
+ vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
1891
+
1892
+ SDL_zero(vertexBufferData);
1893
+ vertexBufferData.pSysMem = vertexData;
1894
+ vertexBufferData.SysMemPitch = 0;
1895
+ vertexBufferData.SysMemSlicePitch = 0;
1896
+
1897
+ result = ID3D11Device_CreateBuffer(rendererData->d3dDevice,
1898
+ &vertexBufferDesc,
1899
+ &vertexBufferData,
1900
+ &rendererData->vertexBuffer
1901
+ );
1902
+ if (FAILED(result)) {
1903
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result);
1904
+ return -1;
1905
+ }
1906
+
1907
+ ID3D11DeviceContext_IASetVertexBuffers(rendererData->d3dContext,
1908
+ 0,
1909
+ 1,
1910
+ &rendererData->vertexBuffer,
1911
+ &stride,
1912
+ &offset
1913
+ );
1914
+ }
1915
+
1916
+ return 0;
1917
+ }
1918
+
1919
+ static void
1920
+ D3D11_RenderStartDrawOp(SDL_Renderer * renderer)
1921
+ {
1922
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
1923
+ ID3D11RasterizerState *rasterizerState;
1924
+ ID3D11RenderTargetView *renderTargetView = D3D11_GetCurrentRenderTargetView(renderer);
1925
+ if (renderTargetView != rendererData->currentRenderTargetView) {
1926
+ ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext,
1927
+ 1,
1928
+ &renderTargetView,
1929
+ NULL
1930
+ );
1931
+ rendererData->currentRenderTargetView = renderTargetView;
1932
+ }
1933
+
1934
+ if (!renderer->clipping_enabled) {
1935
+ rasterizerState = rendererData->mainRasterizer;
1936
+ } else {
1937
+ rasterizerState = rendererData->clippedRasterizer;
1938
+ }
1939
+ if (rasterizerState != rendererData->currentRasterizerState) {
1940
+ ID3D11DeviceContext_RSSetState(rendererData->d3dContext, rasterizerState);
1941
+ rendererData->currentRasterizerState = rasterizerState;
1942
+ }
1943
+ }
1944
+
1945
+ static void
1946
+ D3D11_RenderSetBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
1947
+ {
1948
+ D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
1949
+ ID3D11BlendState *blendState = NULL;
1950
+ if (blendMode != SDL_BLENDMODE_NONE) {
1951
+ int i;
1952
+ for (i = 0; i < rendererData->blendModesCount; ++i) {
1953
+ if (blendMode == rendererData->blendModes[i].blendMode) {
1954
+ blendState = rendererData->blendModes[i].blendState;
1955
+ break;
1956
+ }
1957
+ }
1958
+ if (!blendState) {
1959
+ if (D3D11_CreateBlendState(renderer, blendMode)) {
1960
+ /* Successfully created the blend state, try again */
1961
+ D3D11_RenderSetBlendMode(renderer, blendMode);
1962
+ }
1963
+ return;
1964
+ }
1965
+ }
1966
+ if (blendState != rendererData->currentBlendState) {
1967
+ ID3D11DeviceContext_OMSetBlendState(rendererData->d3dContext, blendState, 0, 0xFFFFFFFF);
1968
+ rendererData->currentBlendState = blendState;
1969
+ }
1970
+ }
1971
+
1972
+ static void
1973
+ D3D11_SetPixelShader(SDL_Renderer * renderer,
1974
+ ID3D11PixelShader * shader,
1975
+ int numShaderResources,
1976
+ ID3D11ShaderResourceView ** shaderResources,
1977
+ ID3D11SamplerState * sampler)
1978
+ {
1979
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
1980
+ ID3D11ShaderResourceView *shaderResource;
1981
+ if (shader != rendererData->currentShader) {
1982
+ ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, shader, NULL, 0);
1983
+ rendererData->currentShader = shader;
1984
+ }
1985
+ if (numShaderResources > 0) {
1986
+ shaderResource = shaderResources[0];
1987
+ } else {
1988
+ shaderResource = NULL;
1989
+ }
1990
+ if (shaderResource != rendererData->currentShaderResource) {
1991
+ ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, numShaderResources, shaderResources);
1992
+ rendererData->currentShaderResource = shaderResource;
1993
+ }
1994
+ if (sampler != rendererData->currentSampler) {
1995
+ ID3D11DeviceContext_PSSetSamplers(rendererData->d3dContext, 0, 1, &sampler);
1996
+ rendererData->currentSampler = sampler;
1997
+ }
1998
+ }
1999
+
2000
+ static void
2001
+ D3D11_RenderFinishDrawOp(SDL_Renderer * renderer,
2002
+ D3D11_PRIMITIVE_TOPOLOGY primitiveTopology,
2003
+ UINT vertexCount)
2004
+ {
2005
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2006
+
2007
+ ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, primitiveTopology);
2008
+ ID3D11DeviceContext_Draw(rendererData->d3dContext, vertexCount, 0);
2009
+ }
2010
+
2011
+ static int
2012
+ D3D11_RenderDrawPoints(SDL_Renderer * renderer,
2013
+ const SDL_FPoint * points, int count)
2014
+ {
2015
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2016
+ float r, g, b, a;
2017
+ VertexPositionColor *vertices;
2018
+ int i;
2019
+
2020
+ r = (float)(renderer->r / 255.0f);
2021
+ g = (float)(renderer->g / 255.0f);
2022
+ b = (float)(renderer->b / 255.0f);
2023
+ a = (float)(renderer->a / 255.0f);
2024
+
2025
+ vertices = SDL_stack_alloc(VertexPositionColor, count);
2026
+ for (i = 0; i < count; ++i) {
2027
+ const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } };
2028
+ vertices[i] = v;
2029
+ }
2030
+
2031
+ D3D11_RenderStartDrawOp(renderer);
2032
+ D3D11_RenderSetBlendMode(renderer, renderer->blendMode);
2033
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, (unsigned int)count * sizeof(VertexPositionColor)) != 0) {
2034
+ SDL_stack_free(vertices);
2035
+ return -1;
2036
+ }
2037
+
2038
+ D3D11_SetPixelShader(
2039
+ renderer,
2040
+ rendererData->pixelShaders[SHADER_SOLID],
2041
+ 0,
2042
+ NULL,
2043
+ NULL);
2044
+
2045
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, count);
2046
+ SDL_stack_free(vertices);
2047
+ return 0;
2048
+ }
2049
+
2050
+ static int
2051
+ D3D11_RenderDrawLines(SDL_Renderer * renderer,
2052
+ const SDL_FPoint * points, int count)
2053
+ {
2054
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2055
+ float r, g, b, a;
2056
+ VertexPositionColor *vertices;
2057
+ int i;
2058
+
2059
+ r = (float)(renderer->r / 255.0f);
2060
+ g = (float)(renderer->g / 255.0f);
2061
+ b = (float)(renderer->b / 255.0f);
2062
+ a = (float)(renderer->a / 255.0f);
2063
+
2064
+ vertices = SDL_stack_alloc(VertexPositionColor, count);
2065
+ for (i = 0; i < count; ++i) {
2066
+ const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } };
2067
+ vertices[i] = v;
2068
+ }
2069
+
2070
+ D3D11_RenderStartDrawOp(renderer);
2071
+ D3D11_RenderSetBlendMode(renderer, renderer->blendMode);
2072
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, (unsigned int)count * sizeof(VertexPositionColor)) != 0) {
2073
+ SDL_stack_free(vertices);
2074
+ return -1;
2075
+ }
2076
+
2077
+ D3D11_SetPixelShader(
2078
+ renderer,
2079
+ rendererData->pixelShaders[SHADER_SOLID],
2080
+ 0,
2081
+ NULL,
2082
+ NULL);
2083
+
2084
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, count);
2085
+
2086
+ if (points[0].x != points[count - 1].x || points[0].y != points[count - 1].y) {
2087
+ ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
2088
+ ID3D11DeviceContext_Draw(rendererData->d3dContext, 1, count - 1);
2089
+ }
2090
+
2091
+ SDL_stack_free(vertices);
2092
+ return 0;
2093
+ }
2094
+
2095
+ static int
2096
+ D3D11_RenderFillRects(SDL_Renderer * renderer,
2097
+ const SDL_FRect * rects, int count)
2098
+ {
2099
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2100
+ float r, g, b, a;
2101
+ int i;
2102
+
2103
+ r = (float)(renderer->r / 255.0f);
2104
+ g = (float)(renderer->g / 255.0f);
2105
+ b = (float)(renderer->b / 255.0f);
2106
+ a = (float)(renderer->a / 255.0f);
2107
+
2108
+ for (i = 0; i < count; ++i) {
2109
+ VertexPositionColor vertices[] = {
2110
+ { { rects[i].x, rects[i].y, 0.0f }, { 0.0f, 0.0f}, {r, g, b, a} },
2111
+ { { rects[i].x, rects[i].y + rects[i].h, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } },
2112
+ { { rects[i].x + rects[i].w, rects[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } },
2113
+ { { rects[i].x + rects[i].w, rects[i].y + rects[i].h, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } },
2114
+ };
2115
+
2116
+ D3D11_RenderStartDrawOp(renderer);
2117
+ D3D11_RenderSetBlendMode(renderer, renderer->blendMode);
2118
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, sizeof(vertices)) != 0) {
2119
+ return -1;
2120
+ }
2121
+
2122
+ D3D11_SetPixelShader(
2123
+ renderer,
2124
+ rendererData->pixelShaders[SHADER_SOLID],
2125
+ 0,
2126
+ NULL,
2127
+ NULL);
2128
+
2129
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, SDL_arraysize(vertices));
2130
+ }
2131
+
2132
+ return 0;
2133
+ }
2134
+
2135
+ static int
2136
+ D3D11_RenderSetupSampler(SDL_Renderer * renderer, SDL_Texture * texture)
2137
+ {
2138
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2139
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
2140
+ ID3D11SamplerState *textureSampler;
2141
+
2142
+ switch (textureData->scaleMode) {
2143
+ case D3D11_FILTER_MIN_MAG_MIP_POINT:
2144
+ textureSampler = rendererData->nearestPixelSampler;
2145
+ break;
2146
+ case D3D11_FILTER_MIN_MAG_MIP_LINEAR:
2147
+ textureSampler = rendererData->linearSampler;
2148
+ break;
2149
+ default:
2150
+ return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
2151
+ }
2152
+
2153
+ if (textureData->yuv) {
2154
+ ID3D11ShaderResourceView *shaderResources[] = {
2155
+ textureData->mainTextureResourceView,
2156
+ textureData->mainTextureResourceViewU,
2157
+ textureData->mainTextureResourceViewV
2158
+ };
2159
+ D3D11_Shader shader;
2160
+
2161
+ switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
2162
+ case SDL_YUV_CONVERSION_JPEG:
2163
+ shader = SHADER_YUV_JPEG;
2164
+ break;
2165
+ case SDL_YUV_CONVERSION_BT601:
2166
+ shader = SHADER_YUV_BT601;
2167
+ break;
2168
+ case SDL_YUV_CONVERSION_BT709:
2169
+ shader = SHADER_YUV_BT709;
2170
+ break;
2171
+ default:
2172
+ return SDL_SetError("Unsupported YUV conversion mode");
2173
+ }
2174
+
2175
+ D3D11_SetPixelShader(
2176
+ renderer,
2177
+ rendererData->pixelShaders[shader],
2178
+ SDL_arraysize(shaderResources),
2179
+ shaderResources,
2180
+ textureSampler);
2181
+
2182
+ } else if (textureData->nv12) {
2183
+ ID3D11ShaderResourceView *shaderResources[] = {
2184
+ textureData->mainTextureResourceView,
2185
+ textureData->mainTextureResourceViewNV,
2186
+ };
2187
+ D3D11_Shader shader;
2188
+
2189
+ switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
2190
+ case SDL_YUV_CONVERSION_JPEG:
2191
+ shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG;
2192
+ break;
2193
+ case SDL_YUV_CONVERSION_BT601:
2194
+ shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601;
2195
+ break;
2196
+ case SDL_YUV_CONVERSION_BT709:
2197
+ shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709;
2198
+ break;
2199
+ default:
2200
+ return SDL_SetError("Unsupported YUV conversion mode");
2201
+ }
2202
+
2203
+ D3D11_SetPixelShader(
2204
+ renderer,
2205
+ rendererData->pixelShaders[shader],
2206
+ SDL_arraysize(shaderResources),
2207
+ shaderResources,
2208
+ textureSampler);
2209
+
2210
+ } else {
2211
+ D3D11_SetPixelShader(
2212
+ renderer,
2213
+ rendererData->pixelShaders[SHADER_RGB],
2214
+ 1,
2215
+ &textureData->mainTextureResourceView,
2216
+ textureSampler);
2217
+ }
2218
+
2219
+ return 0;
2220
+ }
2221
+
2222
+ static int
2223
+ D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
2224
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect)
2225
+ {
2226
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2227
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
2228
+ float minu, maxu, minv, maxv;
2229
+ Float4 color;
2230
+ VertexPositionColor vertices[4];
2231
+
2232
+ D3D11_RenderStartDrawOp(renderer);
2233
+ D3D11_RenderSetBlendMode(renderer, texture->blendMode);
2234
+
2235
+ minu = (float) srcrect->x / texture->w;
2236
+ maxu = (float) (srcrect->x + srcrect->w) / texture->w;
2237
+ minv = (float) srcrect->y / texture->h;
2238
+ maxv = (float) (srcrect->y + srcrect->h) / texture->h;
2239
+
2240
+ color.x = 1.0f; /* red */
2241
+ color.y = 1.0f; /* green */
2242
+ color.z = 1.0f; /* blue */
2243
+ color.w = 1.0f; /* alpha */
2244
+ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
2245
+ color.x = (float)(texture->r / 255.0f); /* red */
2246
+ color.y = (float)(texture->g / 255.0f); /* green */
2247
+ color.z = (float)(texture->b / 255.0f); /* blue */
2248
+ }
2249
+ if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
2250
+ color.w = (float)(texture->a / 255.0f); /* alpha */
2251
+ }
2252
+
2253
+ vertices[0].pos.x = dstrect->x;
2254
+ vertices[0].pos.y = dstrect->y;
2255
+ vertices[0].pos.z = 0.0f;
2256
+ vertices[0].tex.x = minu;
2257
+ vertices[0].tex.y = minv;
2258
+ vertices[0].color = color;
2259
+
2260
+ vertices[1].pos.x = dstrect->x;
2261
+ vertices[1].pos.y = dstrect->y + dstrect->h;
2262
+ vertices[1].pos.z = 0.0f;
2263
+ vertices[1].tex.x = minu;
2264
+ vertices[1].tex.y = maxv;
2265
+ vertices[1].color = color;
2266
+
2267
+ vertices[2].pos.x = dstrect->x + dstrect->w;
2268
+ vertices[2].pos.y = dstrect->y;
2269
+ vertices[2].pos.z = 0.0f;
2270
+ vertices[2].tex.x = maxu;
2271
+ vertices[2].tex.y = minv;
2272
+ vertices[2].color = color;
2273
+
2274
+ vertices[3].pos.x = dstrect->x + dstrect->w;
2275
+ vertices[3].pos.y = dstrect->y + dstrect->h;
2276
+ vertices[3].pos.z = 0.0f;
2277
+ vertices[3].tex.x = maxu;
2278
+ vertices[3].tex.y = maxv;
2279
+ vertices[3].color = color;
2280
+
2281
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, sizeof(vertices)) != 0) {
2282
+ return -1;
2283
+ }
2284
+
2285
+ if (D3D11_RenderSetupSampler(renderer, texture) < 0) {
2286
+ return -1;
2287
+ }
2288
+
2289
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor));
2290
+
2291
+ return 0;
2292
+ }
2293
+
2294
+ static int
2295
+ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
2296
+ const SDL_Rect * srcrect, const SDL_FRect * dstrect,
2297
+ const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
2298
+ {
2299
+ D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
2300
+ D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
2301
+ float minu, maxu, minv, maxv;
2302
+ Float4 color;
2303
+ Float4X4 modelMatrix;
2304
+ float minx, maxx, miny, maxy;
2305
+ VertexPositionColor vertices[4];
2306
+
2307
+ D3D11_RenderStartDrawOp(renderer);
2308
+ D3D11_RenderSetBlendMode(renderer, texture->blendMode);
2309
+
2310
+ minu = (float) srcrect->x / texture->w;
2311
+ maxu = (float) (srcrect->x + srcrect->w) / texture->w;
2312
+ minv = (float) srcrect->y / texture->h;
2313
+ maxv = (float) (srcrect->y + srcrect->h) / texture->h;
2314
+
2315
+ color.x = 1.0f; /* red */
2316
+ color.y = 1.0f; /* green */
2317
+ color.z = 1.0f; /* blue */
2318
+ color.w = 1.0f; /* alpha */
2319
+ if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
2320
+ color.x = (float)(texture->r / 255.0f); /* red */
2321
+ color.y = (float)(texture->g / 255.0f); /* green */
2322
+ color.z = (float)(texture->b / 255.0f); /* blue */
2323
+ }
2324
+ if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
2325
+ color.w = (float)(texture->a / 255.0f); /* alpha */
2326
+ }
2327
+
2328
+ if (flip & SDL_FLIP_HORIZONTAL) {
2329
+ float tmp = maxu;
2330
+ maxu = minu;
2331
+ minu = tmp;
2332
+ }
2333
+ if (flip & SDL_FLIP_VERTICAL) {
2334
+ float tmp = maxv;
2335
+ maxv = minv;
2336
+ minv = tmp;
2337
+ }
2338
+
2339
+ modelMatrix = MatrixMultiply(
2340
+ MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)),
2341
+ MatrixTranslation(dstrect->x + center->x, dstrect->y + center->y, 0)
2342
+ );
2343
+ D3D11_SetModelMatrix(renderer, &modelMatrix);
2344
+
2345
+ minx = -center->x;
2346
+ maxx = dstrect->w - center->x;
2347
+ miny = -center->y;
2348
+ maxy = dstrect->h - center->y;
2349
+
2350
+ vertices[0].pos.x = minx;
2351
+ vertices[0].pos.y = miny;
2352
+ vertices[0].pos.z = 0.0f;
2353
+ vertices[0].tex.x = minu;
2354
+ vertices[0].tex.y = minv;
2355
+ vertices[0].color = color;
2356
+
2357
+ vertices[1].pos.x = minx;
2358
+ vertices[1].pos.y = maxy;
2359
+ vertices[1].pos.z = 0.0f;
2360
+ vertices[1].tex.x = minu;
2361
+ vertices[1].tex.y = maxv;
2362
+ vertices[1].color = color;
2363
+
2364
+ vertices[2].pos.x = maxx;
2365
+ vertices[2].pos.y = miny;
2366
+ vertices[2].pos.z = 0.0f;
2367
+ vertices[2].tex.x = maxu;
2368
+ vertices[2].tex.y = minv;
2369
+ vertices[2].color = color;
2370
+
2371
+ vertices[3].pos.x = maxx;
2372
+ vertices[3].pos.y = maxy;
2373
+ vertices[3].pos.z = 0.0f;
2374
+ vertices[3].tex.x = maxu;
2375
+ vertices[3].tex.y = maxv;
2376
+ vertices[3].color = color;
2377
+
2378
+ if (D3D11_UpdateVertexBuffer(renderer, vertices, sizeof(vertices)) != 0) {
2379
+ return -1;
2380
+ }
2381
+
2382
+ if (D3D11_RenderSetupSampler(renderer, texture) < 0) {
2383
+ return -1;
2384
+ }
2385
+
2386
+ D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor));
2387
+
2388
+ D3D11_SetModelMatrix(renderer, NULL);
2389
+
2390
+ return 0;
2391
+ }
2392
+
2393
+ static int
2394
+ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
2395
+ Uint32 format, void * pixels, int pitch)
2396
+ {
2397
+ D3D11_RenderData * data = (D3D11_RenderData *) renderer->driverdata;
2398
+ ID3D11Texture2D *backBuffer = NULL;
2399
+ ID3D11Texture2D *stagingTexture = NULL;
2400
+ HRESULT result;
2401
+ int status = -1;
2402
+ D3D11_TEXTURE2D_DESC stagingTextureDesc;
2403
+ D3D11_RECT srcRect = {0, 0, 0, 0};
2404
+ D3D11_BOX srcBox;
2405
+ D3D11_MAPPED_SUBRESOURCE textureMemory;
2406
+
2407
+ /* Retrieve a pointer to the back buffer: */
2408
+ result = IDXGISwapChain_GetBuffer(data->swapChain,
2409
+ 0,
2410
+ &SDL_IID_ID3D11Texture2D,
2411
+ (void **)&backBuffer
2412
+ );
2413
+ if (FAILED(result)) {
2414
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::GetBuffer [get back buffer]"), result);
2415
+ goto done;
2416
+ }
2417
+
2418
+ /* Create a staging texture to copy the screen's data to: */
2419
+ ID3D11Texture2D_GetDesc(backBuffer, &stagingTextureDesc);
2420
+ stagingTextureDesc.Width = rect->w;
2421
+ stagingTextureDesc.Height = rect->h;
2422
+ stagingTextureDesc.BindFlags = 0;
2423
+ stagingTextureDesc.MiscFlags = 0;
2424
+ stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
2425
+ stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
2426
+ result = ID3D11Device_CreateTexture2D(data->d3dDevice,
2427
+ &stagingTextureDesc,
2428
+ NULL,
2429
+ &stagingTexture);
2430
+ if (FAILED(result)) {
2431
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
2432
+ goto done;
2433
+ }
2434
+
2435
+ /* Copy the desired portion of the back buffer to the staging texture: */
2436
+ if (D3D11_GetViewportAlignedD3DRect(renderer, rect, &srcRect, FALSE) != 0) {
2437
+ /* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
2438
+ goto done;
2439
+ }
2440
+
2441
+ srcBox.left = srcRect.left;
2442
+ srcBox.right = srcRect.right;
2443
+ srcBox.top = srcRect.top;
2444
+ srcBox.bottom = srcRect.bottom;
2445
+ srcBox.front = 0;
2446
+ srcBox.back = 1;
2447
+ ID3D11DeviceContext_CopySubresourceRegion(data->d3dContext,
2448
+ (ID3D11Resource *)stagingTexture,
2449
+ 0,
2450
+ 0, 0, 0,
2451
+ (ID3D11Resource *)backBuffer,
2452
+ 0,
2453
+ &srcBox);
2454
+
2455
+ /* Map the staging texture's data to CPU-accessible memory: */
2456
+ result = ID3D11DeviceContext_Map(data->d3dContext,
2457
+ (ID3D11Resource *)stagingTexture,
2458
+ 0,
2459
+ D3D11_MAP_READ,
2460
+ 0,
2461
+ &textureMemory);
2462
+ if (FAILED(result)) {
2463
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
2464
+ goto done;
2465
+ }
2466
+
2467
+ /* Copy the data into the desired buffer, converting pixels to the
2468
+ * desired format at the same time:
2469
+ */
2470
+ if (SDL_ConvertPixels(
2471
+ rect->w, rect->h,
2472
+ D3D11_DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format),
2473
+ textureMemory.pData,
2474
+ textureMemory.RowPitch,
2475
+ format,
2476
+ pixels,
2477
+ pitch) != 0) {
2478
+ /* When SDL_ConvertPixels fails, it'll have already set the format.
2479
+ * Get the error message, and attach some extra data to it.
2480
+ */
2481
+ char errorMessage[1024];
2482
+ SDL_snprintf(errorMessage, sizeof(errorMessage), "%s, Convert Pixels failed: %s", __FUNCTION__, SDL_GetError());
2483
+ SDL_SetError("%s", errorMessage);
2484
+ goto done;
2485
+ }
2486
+
2487
+ /* Unmap the texture: */
2488
+ ID3D11DeviceContext_Unmap(data->d3dContext,
2489
+ (ID3D11Resource *)stagingTexture,
2490
+ 0);
2491
+
2492
+ status = 0;
2493
+
2494
+ done:
2495
+ SAFE_RELEASE(backBuffer);
2496
+ SAFE_RELEASE(stagingTexture);
2497
+ return status;
2498
+ }
2499
+
2500
+ static void
2501
+ D3D11_RenderPresent(SDL_Renderer * renderer)
2502
+ {
2503
+ D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
2504
+ UINT syncInterval;
2505
+ UINT presentFlags;
2506
+ HRESULT result;
2507
+ DXGI_PRESENT_PARAMETERS parameters;
2508
+
2509
+ SDL_zero(parameters);
2510
+
2511
+ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
2512
+ syncInterval = 1;
2513
+ presentFlags = 0;
2514
+ result = IDXGISwapChain_Present(data->swapChain, syncInterval, presentFlags);
2515
+ #else
2516
+ if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
2517
+ syncInterval = 1;
2518
+ presentFlags = 0;
2519
+ } else {
2520
+ syncInterval = 0;
2521
+ presentFlags = DXGI_PRESENT_DO_NOT_WAIT;
2522
+ }
2523
+
2524
+ /* The application may optionally specify "dirty" or "scroll"
2525
+ * rects to improve efficiency in certain scenarios.
2526
+ * This option is not available on Windows Phone 8, to note.
2527
+ */
2528
+ result = IDXGISwapChain1_Present1(data->swapChain, syncInterval, presentFlags, &parameters);
2529
+ #endif
2530
+
2531
+ /* Discard the contents of the render target.
2532
+ * This is a valid operation only when the existing contents will be entirely
2533
+ * overwritten. If dirty or scroll rects are used, this call should be removed.
2534
+ */
2535
+ ID3D11DeviceContext1_DiscardView(data->d3dContext, (ID3D11View*)data->mainRenderTargetView);
2536
+
2537
+ /* When the present flips, it unbinds the current view, so bind it again on the next draw call */
2538
+ data->currentRenderTargetView = NULL;
2539
+
2540
+ if (FAILED(result) && result != DXGI_ERROR_WAS_STILL_DRAWING) {
2541
+ /* If the device was removed either by a disconnect or a driver upgrade, we
2542
+ * must recreate all device resources.
2543
+ *
2544
+ * TODO, WinRT: consider throwing an exception if D3D11_RenderPresent fails, especially if there is a way to salvage debug info from users' machines
2545
+ */
2546
+ if ( result == DXGI_ERROR_DEVICE_REMOVED ) {
2547
+ D3D11_HandleDeviceLost(renderer);
2548
+ } else if (result == DXGI_ERROR_INVALID_CALL) {
2549
+ /* We probably went through a fullscreen <-> windowed transition */
2550
+ D3D11_CreateWindowSizeDependentResources(renderer);
2551
+ } else {
2552
+ WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::Present"), result);
2553
+ }
2554
+ }
2555
+ }
2556
+
2557
+ #endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
2558
+
2559
+ /* vi: set ts=4 sw=4 expandtab: */