From c84752f38c3bb3ddcba439e193d6390b11174b00 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 5 Mar 2024 16:17:29 -0800 Subject: [PATCH] D3D11 support --- lib/RefreshCS | 2 +- src/Game.cs | 3 +- src/Graphics/CommandBuffer.cs | 88 ------------------ src/Graphics/RefreshEnums.cs | 1 + .../StockShaders/Binary/blit.frag.refresh | Bin 645 -> 1262 bytes .../Binary/fullscreen.vert.refresh | Bin 1997 -> 2038 bytes .../Binary/text_msdf.frag.refresh | Bin 2697 -> 4335 bytes .../Binary/text_transform.vert.refresh | Bin 1529 -> 2642 bytes .../Binary/video_yuv2rgba.frag.refresh | Bin 3030 -> 3034 bytes 9 files changed, 4 insertions(+), 90 deletions(-) diff --git a/lib/RefreshCS b/lib/RefreshCS index 86cc5fa..7465d4d 160000 --- a/lib/RefreshCS +++ b/lib/RefreshCS @@ -1 +1 @@ -Subproject commit 86cc5fa1422c8b79c436c4e4fc345114e9615dbb +Subproject commit 7465d4d4de1a0f2c5de5a2d0b3240671e83776d1 diff --git a/src/Game.cs b/src/Game.cs index 096afc7..cf1e133 100644 --- a/src/Game.cs +++ b/src/Game.cs @@ -53,6 +53,7 @@ namespace MoonWorks public Game( WindowCreateInfo windowCreateInfo, FrameLimiterSettings frameLimiterSettings, + Backend backend = Backend.Vulkan, int targetTimestep = 60, bool debugMode = false ) @@ -82,7 +83,7 @@ namespace MoonWorks Logger.LogInfo("Initializing graphics device..."); GraphicsDevice = new GraphicsDevice( - Backend.Vulkan, + backend, debugMode ); diff --git a/src/Graphics/CommandBuffer.cs b/src/Graphics/CommandBuffer.cs index b1f4d43..a0f5c0b 100644 --- a/src/Graphics/CommandBuffer.cs +++ b/src/Graphics/CommandBuffer.cs @@ -2087,94 +2087,6 @@ namespace MoonWorks.Graphics ); } - /// - /// Copies the contents of a Texture to a GpuBuffer. - /// This copy occurs on the GPU timeline. - /// - /// You MAY assume that the copy has finished in subsequent commands. - /// - public void CopyTextureToBuffer( - in TextureRegion textureRegion, - GpuBuffer buffer, - in BufferImageCopy copyParams, - WriteOptions option - ) { -#if DEBUG - AssertNotSubmitted(); - AssertInCopyPass("Cannot download from texture outside of copy pass!"); - AssertBufferBoundsCheck(buffer.Size, copyParams.BufferOffset, textureRegion.Size); -#endif - - Refresh.Refresh_CopyTextureToBuffer( - Device.Handle, - Handle, - textureRegion.ToRefreshTextureRegion(), - buffer.Handle, - copyParams.ToRefresh(), - (Refresh.WriteOptions) option - ); - } - - /// - /// Copies the entire contents of a Texture to a GpuBuffer. - /// - public void CopyTextureToBuffer( - Texture texture, - GpuBuffer buffer, - WriteOptions option - ) { - CopyTextureToBuffer( - new TextureRegion(texture), - buffer, - new BufferImageCopy(0, 0, 0), - option - ); - } - - /// - /// Copies the contents of a GpuBuffer to a Texture. - /// This copy occurs on the GPU timeline. - /// - /// You MAY assume that the copy has finished in subsequent commands. - /// - public void CopyBufferToTexture( - GpuBuffer gpuBuffer, - in TextureRegion textureRegion, - in BufferImageCopy copyParams, - WriteOptions option - ) { -#if DEBUG - AssertNotSubmitted(); - AssertInCopyPass("Cannot download from texture outside of copy pass!"); - AssertBufferBoundsCheck(gpuBuffer.Size, copyParams.BufferOffset, textureRegion.Size); -#endif - - Refresh.Refresh_CopyBufferToTexture( - Device.Handle, - Handle, - gpuBuffer.Handle, - textureRegion.ToRefreshTextureRegion(), - copyParams.ToRefresh(), - (Refresh.WriteOptions) option - ); - } - - /// - /// Copies the entire contents of a Texture with no mips to a GpuBuffer. - /// - public void CopyBufferToTexture( - GpuBuffer buffer, - Texture texture, - WriteOptions option - ) { - CopyBufferToTexture( - buffer, - new TextureRegion(texture), - new BufferImageCopy(0, 0, 0), - option - ); - } - /// /// Copies data from a GpuBuffer to another GpuBuffer. /// This copy occurs on the GPU timeline. diff --git a/src/Graphics/RefreshEnums.cs b/src/Graphics/RefreshEnums.cs index 918bdb1..2e1b9f8 100644 --- a/src/Graphics/RefreshEnums.cs +++ b/src/Graphics/RefreshEnums.cs @@ -313,6 +313,7 @@ namespace MoonWorks.Graphics { DontCare, Vulkan, + D3D11, PS5, Invalid } diff --git a/src/Graphics/StockShaders/Binary/blit.frag.refresh b/src/Graphics/StockShaders/Binary/blit.frag.refresh index ac3850ae3ef5304990776ec6f1f7587bd7c0e3fb..a64dddb90d2da6cbed35983dc87e61b66d6e31c5 100644 GIT binary patch literal 1262 zcmZ`&U279T6rCnbTeogMtSBPLR9{*sA(SX$ZC}zh76OrMsJ@L$G7SscY?z%CMf>Oc zRlW$GGuiA8r~@~5?wK>^e#~ZY8GTq0Lah9#2~n@TTE|vwicmZT$h9kKKm@Qg=exbA z*Uas>*?!&P`Ie~DxwCDtE>^Lp-Nwn3_ygE3YzI8zNPt}(szUsP@Tv$zx2L-Oez$j_ zMzfj9?YC5`G?{8OPK+Meh1);Dehrv} zJq4e0V9c5&emCGbN#Z9(%o>P2Lp1?B`ONRHW&9k>O&pL%y@v&f81)#l2QKE{hNm9u zB!357mx=0DNyFvf>EC_H6Fou{}Wj3X%9vY@iQo}H)6k$ z;VrE81sU)Nc5d|X`TLtRi*5T%R!=40Nuwu8ZnZhEt;3TrDBdu#vDH#lOqDMl*T0dw z8)1-xoQ&i`UX~vR)cliU=5?O~4tQkdBP*kiSA%QSF1rCk*Tndn*#V>8jV(z(l$vAn@ot@sx^I4p}On~|s9*qVze z9sFZHM`f3s<~=+0TU=BpT^1jAtxJq+qE*5%R3$8@h6=p%<`PC0H?6Ap0`cXGw2S+h Zn^3{>p{Cz$xi5%D<13mLC6p3q@DGy=`vw32 delta 13 UcmaFI*~-ci diff --git a/src/Graphics/StockShaders/Binary/fullscreen.vert.refresh b/src/Graphics/StockShaders/Binary/fullscreen.vert.refresh index 131f3a6723eca7e74fc34ae78601249f78245eb0..762caae8e41d3634bd49e08021b7e702e7684580 100644 GIT binary patch delta 66 zcmX@h|Bas`$Sv4|0SGp-++<;95@6o^faN%&k^&H<=fnr(7iX4a=I7~ED%dLMq6lnW I!luax0D;yNRR910 delta 27 jcmeyyf0mym$Sv4oBgah^X6DySo1d^8XWV>&O^p!%i{c5j diff --git a/src/Graphics/StockShaders/Binary/text_msdf.frag.refresh b/src/Graphics/StockShaders/Binary/text_msdf.frag.refresh index ba50a5aa2a2d33d398d20d8b5b57b6728ccf2cc0..ad0a698599d78c80abc8ddf52395272bf5faa6ff 100644 GIT binary patch delta 1664 zcmZux$&S-N5Df?+6e&mU&8-c_I3WlL7!H%LjD(a?JdC&?%W>MKMZBop9-KkQCk}iL zU&b#`)r;*+CQ=f+mRD7;mOl^wJ$kTyAAGzs8jb$m`#o;&e!V{$#hW@wm>{1|SL78D zEajDCf^K|gGX6Ok6Zj;%B9f%u6k*w{qda9`SVr;pB1tMHY3w_%C*xo6os2J7BWuBC z%Qwnt{+49bHW>m-WgSFW+3uJKWF#30(I~7y2BM*HrHm)z3e0${6PXd7LzqQTh%Lk% zs^+Aq<)YXX;z+@BD@PYm$C9+c`Puq1T!^Bo!n3@r_#v8D2ypWfB8voSNryMym44&>Qe;MvtimiA&Iy zd}3E@=OP>W{X7y;);Cn+wSq}g3wU}Tm|XIVnb(b@#;Xrd#e%W?T#q8{ z;B=+o{AIYUvuq!hSTloJHu7YTVxwuPi!*6txFB!ZwF zLstdgl0-ylm_48%1?={DoaB6h> zTXZv{>k(VLDmouMG78?+QNpQxm|14@MA_~y;Z8+)jI>&jYAbbsG77Ly3G#R7T)^4l zat}W7E^4!qTGtNkiSlyc*N1LfZm}`lik=X-QYA$TXl4WJVQv5{oW@t;t|!Oq4-*f~ zIleyxN=jMC@fP*1>t_UO?Jc}sVfePU=%$%HeON|69J%G@mIQSeC>b&_;6sr&Aj3Wy NGc&(KYtX=b_z&-L3vd7c delta 13 UcmaE_*eS{qF<)~EibKK(b9X{t9Xw< zHEwuILOfxY?cCh&?AOL=zt;G&j{Taq%w%oX<;7T$oOHv8bw%=lgkG`!)NAoDN;~1NI+>WvM$WSB4#UyYaGZ9d zUNE)61h&a=IJK2jCmb+X-_ZQ>hn9_D%{UB$*X<;JMV(5+`rQ;hIf}JjvHXRR(iB$G z2bb|AeG#1P#&OcO7~F=@6tWmx%WpRx#)+1~RxI~nltFt!vX0T;Y!q15^Q^B0M(y}f zXMwQ>gZHK^tnu3uQq)(ndTFY!OJ}f0;iHS^y(?i4F!pF_4|ur0psz`1VCQbFS}oJz z#?|2koqF(x6Ib8NbM419h>!t<`1CMsi2-5L-3of7JI`;;QbFNvxY+uenzb;|il@538OJ1vrfrWLW|!+z_U@hQ%G zpfz@I_Cu#{V8nl>nY{};`okQx>^p!on(jDVmcwrFpj}Y$U_xh#w zTN3zy&mDQf!)*yTI(2_2q2`|yLoN4mOw$zmILA1*@Z+u#OAc)@LXMwEh{qp0-2JJ2 zu^9 z#z9)`)i<70%D+qa^iHN>FON3PlPkMx`@+~~ZUNmk&SQ7ZHhc6IObx>9LwC-QKY+qH zKbiDW(`i3HIP`aucs%x>N25tPt=`t0XQm=wJo|aK)jD`uS2W~U^R^N%-d@M&vFp>2 zk4?vM*p@>^(gkU>Ch566=D2V+n#*QZx#O{ri_-)-bq=Thg42vnBGTa?{My s&r%U518E68~^|S delta 13 Ucmca4@{^k-$Sv4oBga=(03(Y8)c^nh diff --git a/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.refresh b/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.refresh index 176e8b4cab11b1f354d8b8560720f4bdc97b806f..1493276bb2b61c7587574e95a86de71e7e6fadd1 100644 GIT binary patch delta 24 fcmca6eoLGq$Sv4|k%56>Bg;-UMyAdC*d$m1RnZ0} delta 20 bcmca5eodSu$Sv4oBgalQM&`|j*d$m1Nni#l