using Refresh again
							parent
							
								
									3cfb43438c
								
							
						
					
					
						commit
						baf51d2ee9
					
				|  | @ -10,6 +10,6 @@ | ||||||
| [submodule "lib/dav1dfile"] | [submodule "lib/dav1dfile"] | ||||||
| 	path = lib/dav1dfile | 	path = lib/dav1dfile | ||||||
| 	url = https://github.com/MoonsideGames/dav1dfile.git | 	url = https://github.com/MoonsideGames/dav1dfile.git | ||||||
| [submodule "SDL2_gpuCS"] | [submodule "lib/RefreshCS"] | ||||||
| 	path = lib/SDL2_gpuCS | 	path = lib/RefreshCS | ||||||
| 	url = https://github.com/MoonsideGames/SDL2_gpuCS.git | 	url = https://github.com/MoonsideGames/RefreshCS.git | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| 
 | 
 | ||||||
| 	<ItemGroup> | 	<ItemGroup> | ||||||
| 		<Compile Include="lib\FAudio\csharp\FAudio.cs" /> | 		<Compile Include="lib\FAudio\csharp\FAudio.cs" /> | ||||||
| 		<Compile Include="lib\SDL2_gpuCS\SDL2_gpuCS.cs" /> | 		<Compile Include="lib\RefreshCS\RefreshCS.cs" /> | ||||||
| 		<Compile Include="lib\SDL2-CS\src\SDL2.cs" /> | 		<Compile Include="lib\SDL2-CS\src\SDL2.cs" /> | ||||||
| 		<Compile Include="lib\WellspringCS\WellspringCS.cs" /> | 		<Compile Include="lib\WellspringCS\WellspringCS.cs" /> | ||||||
| 		<Compile Include="lib\dav1dfile\csharp\dav1dfile.cs" /> | 		<Compile Include="lib\dav1dfile\csharp\dav1dfile.cs" /> | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | Subproject commit a0cdff3054c646a532e5850c0ab89d4611069237 | ||||||
|  | @ -1 +0,0 @@ | ||||||
| Subproject commit 70925aa394c0f24388f3cfb97f1c6ee1f91baf52 |  | ||||||
|  | @ -85,8 +85,14 @@ namespace MoonWorks | ||||||
| 				debugMode | 				debugMode | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
|  | 			SDL.SDL_WindowFlags windowFlags = 0; | ||||||
|  | 			if ((preferredBackends & BackendFlags.Vulkan) != 0) | ||||||
|  | 			{ | ||||||
|  | 				windowFlags |= SDL.SDL_WindowFlags.SDL_WINDOW_VULKAN; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			Logger.LogInfo("Initializing main window..."); | 			Logger.LogInfo("Initializing main window..."); | ||||||
| 			MainWindow = new Window(windowCreateInfo, GraphicsDevice.WindowFlags | SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN); | 			MainWindow = new Window(windowCreateInfo, windowFlags | SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN); | ||||||
| 
 | 
 | ||||||
| 			if (!GraphicsDevice.ClaimWindow(MainWindow, windowCreateInfo.SwapchainComposition, windowCreateInfo.PresentMode)) | 			if (!GraphicsDevice.ClaimWindow(MainWindow, windowCreateInfo.SwapchainComposition, windowCreateInfo.PresentMode)) | ||||||
| 			{ | 			{ | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| using System; | using System; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2; | using RefreshCS; | ||||||
| using SDL2_gpuCS; |  | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
|  | @ -82,7 +81,7 @@ public class CommandBuffer | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var texturePtr = SDL_Gpu.SDL_GpuAcquireSwapchainTexture( | 		var texturePtr = Refresh.Refresh_AcquireSwapchainTexture( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			window.Handle, | 			window.Handle, | ||||||
| 			out var width, | 			out var width, | ||||||
|  | @ -123,14 +122,14 @@ public class CommandBuffer | ||||||
| 		AssertColorTarget(colorAttachmentInfo); | 		AssertColorTarget(colorAttachmentInfo); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[1]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfo.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			1, | 			1, | ||||||
| 			(SDL_Gpu.DepthStencilAttachmentInfo*) nint.Zero | 			(Refresh.DepthStencilAttachmentInfo*) nint.Zero | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		var renderPass = Device.RenderPassPool.Obtain(); | 		var renderPass = Device.RenderPassPool.Obtain(); | ||||||
|  | @ -171,15 +170,15 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[2]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToSDL(); | 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			2, | 			2, | ||||||
| 			(SDL_Gpu.DepthStencilAttachmentInfo*) nint.Zero | 			(Refresh.DepthStencilAttachmentInfo*) nint.Zero | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		var renderPass = Device.RenderPassPool.Obtain(); | 		var renderPass = Device.RenderPassPool.Obtain(); | ||||||
|  | @ -227,16 +226,16 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[3]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToSDL(); | 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToSDL(); | 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			3, | 			3, | ||||||
| 			(SDL_Gpu.DepthStencilAttachmentInfo*) nint.Zero | 			(Refresh.DepthStencilAttachmentInfo*) nint.Zero | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		var renderPass = Device.RenderPassPool.Obtain(); | 		var renderPass = Device.RenderPassPool.Obtain(); | ||||||
|  | @ -290,17 +289,17 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoFour.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoFour.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[4]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToSDL(); | 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToSDL(); | 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[3] = colorAttachmentInfoFour.ToSDL(); | 		sdlColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			4, | 			4, | ||||||
| 			(SDL_Gpu.DepthStencilAttachmentInfo*) nint.Zero | 			(Refresh.DepthStencilAttachmentInfo*) nint.Zero | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		var renderPass = Device.RenderPassPool.Obtain(); | 		var renderPass = Device.RenderPassPool.Obtain(); | ||||||
|  | @ -334,11 +333,11 @@ public class CommandBuffer | ||||||
| 		AssertValidDepthAttachment(depthStencilAttachmentInfo); | 		AssertValidDepthAttachment(depthStencilAttachmentInfo); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToSDL(); | 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			(SDL_Gpu.ColorAttachmentInfo*) nint.Zero, | 			(Refresh.ColorAttachmentInfo*) nint.Zero, | ||||||
| 			0, | 			0, | ||||||
| 			&sdlDepthStencilAttachmentInfo | 			&sdlDepthStencilAttachmentInfo | ||||||
| 		); | 		); | ||||||
|  | @ -376,12 +375,12 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfo.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfo.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[1]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfo.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToSDL(); | 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			1, | 			1, | ||||||
|  | @ -431,13 +430,13 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[2]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToSDL(); | 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToSDL(); | 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			2, | 			2, | ||||||
|  | @ -494,14 +493,14 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[3]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToSDL(); | 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToSDL(); | 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToSDL(); | 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			3, | 			3, | ||||||
|  | @ -565,15 +564,15 @@ public class CommandBuffer | ||||||
| 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | 		AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlColorAttachmentInfos = stackalloc SDL_Gpu.ColorAttachmentInfo[4]; | 		var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4]; | ||||||
| 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToSDL(); | 		sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToSDL(); | 		sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToSDL(); | 		sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh(); | ||||||
| 		sdlColorAttachmentInfos[3] = colorAttachmentInfoFour.ToSDL(); | 		sdlColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToSDL(); | 		var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var renderPassHandle = SDL_Gpu.SDL_GpuBeginRenderPass( | 		var renderPassHandle = Refresh.Refresh_BeginRenderPass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			sdlColorAttachmentInfos, | 			sdlColorAttachmentInfos, | ||||||
| 			4, | 			4, | ||||||
|  | @ -613,7 +612,7 @@ public class CommandBuffer | ||||||
| 		renderPass.active = false; | 		renderPass.active = false; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuEndRenderPass( | 		Refresh.Refresh_EndRenderPass( | ||||||
| 			renderPass.Handle | 			renderPass.Handle | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
|  | @ -633,11 +632,11 @@ public class CommandBuffer | ||||||
| 		Filter filter, | 		Filter filter, | ||||||
| 		bool cycle | 		bool cycle | ||||||
| 	) { | 	) { | ||||||
| 		SDL_Gpu.SDL_GpuBlit( | 		Refresh.Refresh_Blit( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			source.ToSDL(), | 			source.ToRefresh(), | ||||||
| 			destination.ToSDL(), | 			destination.ToRefresh(), | ||||||
| 			(SDL_Gpu.Filter) filter, | 			(Refresh.Filter) filter, | ||||||
| 			Conversions.BoolToInt(cycle) | 			Conversions.BoolToInt(cycle) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
|  | @ -651,13 +650,13 @@ public class CommandBuffer | ||||||
| 		computePassActive = true; | 		computePassActive = true; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureBinding = readWriteTextureBinding.ToSDL(); | 		var sdlTextureBinding = readWriteTextureBinding.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var computePassHandle = SDL_Gpu.SDL_GpuBeginComputePass( | 		var computePassHandle = Refresh.Refresh_BeginComputePass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			&sdlTextureBinding, | 			&sdlTextureBinding, | ||||||
| 			1, | 			1, | ||||||
| 			(SDL_Gpu.StorageBufferReadWriteBinding*) nint.Size, | 			(Refresh.StorageBufferReadWriteBinding*) nint.Size, | ||||||
| 			0 | 			0 | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
|  | @ -680,11 +679,11 @@ public class CommandBuffer | ||||||
| 		computePassActive = true; | 		computePassActive = true; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlBufferBinding = readWriteBufferBinding.ToSDL(); | 		var sdlBufferBinding = readWriteBufferBinding.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var computePassHandle = SDL_Gpu.SDL_GpuBeginComputePass( | 		var computePassHandle = Refresh.Refresh_BeginComputePass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			(SDL_Gpu.StorageTextureReadWriteBinding*) nint.Zero, | 			(Refresh.StorageTextureReadWriteBinding*) nint.Zero, | ||||||
| 			0, | 			0, | ||||||
| 			&sdlBufferBinding, | 			&sdlBufferBinding, | ||||||
| 			1 | 			1 | ||||||
|  | @ -710,10 +709,10 @@ public class CommandBuffer | ||||||
| 		computePassActive = true; | 		computePassActive = true; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureBinding = readWriteTextureBinding.ToSDL(); | 		var sdlTextureBinding = readWriteTextureBinding.ToRefresh(); | ||||||
| 		var sdlBufferBinding = readWriteBufferBinding.ToSDL(); | 		var sdlBufferBinding = readWriteBufferBinding.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		var computePassHandle = SDL_Gpu.SDL_GpuBeginComputePass( | 		var computePassHandle = Refresh.Refresh_BeginComputePass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			&sdlTextureBinding, | 			&sdlTextureBinding, | ||||||
| 			1, | 			1, | ||||||
|  | @ -749,11 +748,11 @@ public class CommandBuffer | ||||||
| 			(nuint) (readWriteBufferBindings.Length * Marshal.SizeOf<StorageBufferReadWriteBinding>()) | 			(nuint) (readWriteBufferBindings.Length * Marshal.SizeOf<StorageBufferReadWriteBinding>()) | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		var computePassHandle = SDL_Gpu.SDL_GpuBeginComputePass( | 		var computePassHandle = Refresh.Refresh_BeginComputePass( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			(SDL_Gpu.StorageTextureReadWriteBinding*) sdlTextureBindings, | 			(Refresh.StorageTextureReadWriteBinding*) sdlTextureBindings, | ||||||
| 			(uint) readWriteTextureBindings.Length, | 			(uint) readWriteTextureBindings.Length, | ||||||
| 			(SDL_Gpu.StorageBufferReadWriteBinding*) sdlBufferBindings, | 			(Refresh.StorageBufferReadWriteBinding*) sdlBufferBindings, | ||||||
| 			(uint) readWriteBufferBindings.Length | 			(uint) readWriteBufferBindings.Length | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
|  | @ -779,7 +778,7 @@ public class CommandBuffer | ||||||
| 		computePass.active = false; | 		computePass.active = false; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuEndComputePass( | 		Refresh.Refresh_EndComputePass( | ||||||
| 			computePass.Handle | 			computePass.Handle | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
|  | @ -802,7 +801,7 @@ public class CommandBuffer | ||||||
| 		copyPassActive = true; | 		copyPassActive = true; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var copyPassHandle = SDL_Gpu.SDL_GpuBeginCopyPass(Handle); | 		var copyPassHandle = Refresh.Refresh_BeginCopyPass(Handle); | ||||||
| 
 | 
 | ||||||
| 		var copyPass = Device.CopyPassPool.Obtain(); | 		var copyPass = Device.CopyPassPool.Obtain(); | ||||||
| 		copyPass.SetHandle(copyPassHandle); | 		copyPass.SetHandle(copyPassHandle); | ||||||
|  | @ -818,7 +817,7 @@ public class CommandBuffer | ||||||
| 		copyPassActive = false; | 		copyPassActive = false; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuEndCopyPass( | 		Refresh.Refresh_EndCopyPass( | ||||||
| 			copyPass.Handle | 			copyPass.Handle | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2; | using RefreshCS; | ||||||
| using SDL2_gpuCS; |  | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
|  | @ -32,7 +31,7 @@ public class ComputePass | ||||||
| 		// TODO: validate formats? | 		// TODO: validate formats? | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindComputePipeline( | 		Refresh.Refresh_BindComputePipeline( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			computePipeline.Handle | 			computePipeline.Handle | ||||||
| 		); | 		); | ||||||
|  | @ -57,9 +56,9 @@ public class ComputePass | ||||||
| 		AssertTextureHasComputeStorageReadFlag(textureSlice.Texture); | 		AssertTextureHasComputeStorageReadFlag(textureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureSlice = textureSlice.ToSDL(); | 		var sdlTextureSlice = textureSlice.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindComputeStorageTextures( | 		Refresh.Refresh_BindComputeStorageTextures( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&sdlTextureSlice, | 			&sdlTextureSlice, | ||||||
|  | @ -84,7 +83,7 @@ public class ComputePass | ||||||
| 
 | 
 | ||||||
| 		var bufferHandle = buffer.Handle; | 		var bufferHandle = buffer.Handle; | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindComputeStorageBuffers( | 		Refresh.Refresh_BindComputeStorageBuffers( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&bufferHandle, | 			&bufferHandle, | ||||||
|  | @ -111,7 +110,7 @@ public class ComputePass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuPushComputeUniformData( | 		Refresh.Refresh_PushComputeUniformData( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			(nint) uniformsPtr, | 			(nint) uniformsPtr, | ||||||
|  | @ -153,7 +152,7 @@ public class ComputePass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuDispatchCompute( | 		Refresh.Refresh_DispatchCompute( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			groupCountX, | 			groupCountX, | ||||||
| 			groupCountY, | 			groupCountY, | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
|  | @ -32,11 +32,11 @@ public class CopyPass | ||||||
| 		AssertBufferBoundsCheck(transferBuffer.Size, copyParams.BufferOffset, textureRegion.Size); | 		AssertBufferBoundsCheck(transferBuffer.Size, copyParams.BufferOffset, textureRegion.Size); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuUploadToTexture( | 		Refresh.Refresh_UploadToTexture( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			transferBuffer.Handle, | 			transferBuffer.Handle, | ||||||
| 			textureRegion.ToSDL(), | 			textureRegion.ToRefresh(), | ||||||
| 			copyParams.ToSDL(), | 			copyParams.ToRefresh(), | ||||||
| 			Conversions.BoolToInt(cycle) | 			Conversions.BoolToInt(cycle) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
|  | @ -78,11 +78,11 @@ public class CopyPass | ||||||
| 		AssertBufferBoundsCheck(buffer.Size, copyParams.DstOffset, copyParams.Size); | 		AssertBufferBoundsCheck(buffer.Size, copyParams.DstOffset, copyParams.Size); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuUploadToBuffer( | 		Refresh.Refresh_UploadToBuffer( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			transferBuffer.Handle, | 			transferBuffer.Handle, | ||||||
| 			buffer.Handle, | 			buffer.Handle, | ||||||
| 			copyParams.ToSDL(), | 			copyParams.ToRefresh(), | ||||||
| 			Conversions.BoolToInt(cycle) | 			Conversions.BoolToInt(cycle) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
|  | @ -149,10 +149,10 @@ public class CopyPass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuCopyTextureToTexture( | 		Refresh.Refresh_CopyTextureToTexture( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			source.ToSDL(), | 			source.ToRefresh(), | ||||||
| 			destination.ToSDL(), | 			destination.ToRefresh(), | ||||||
| 			Conversions.BoolToInt(cycle) | 			Conversions.BoolToInt(cycle) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
|  | @ -174,11 +174,11 @@ public class CopyPass | ||||||
| 		AssertBufferBoundsCheck(destination.Size, copyParams.DstOffset, copyParams.Size); | 		AssertBufferBoundsCheck(destination.Size, copyParams.DstOffset, copyParams.Size); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuCopyBufferToBuffer( | 		Refresh.Refresh_CopyBufferToBuffer( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			source.Handle, | 			source.Handle, | ||||||
| 			destination.Handle, | 			destination.Handle, | ||||||
| 			copyParams.ToSDL(), | 			copyParams.ToRefresh(), | ||||||
| 			Conversions.BoolToInt(cycle) | 			Conversions.BoolToInt(cycle) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ namespace MoonWorks.Graphics.Font | ||||||
| 			VertexBuffer = GpuBuffer.Create<Vertex>(GraphicsDevice, BufferUsageFlags.Vertex, INITIAL_VERTEX_COUNT); | 			VertexBuffer = GpuBuffer.Create<Vertex>(GraphicsDevice, BufferUsageFlags.Vertex, INITIAL_VERTEX_COUNT); | ||||||
| 			IndexBuffer = GpuBuffer.Create<uint>(GraphicsDevice, BufferUsageFlags.Index, INITIAL_INDEX_COUNT); | 			IndexBuffer = GpuBuffer.Create<uint>(GraphicsDevice, BufferUsageFlags.Index, INITIAL_INDEX_COUNT); | ||||||
| 
 | 
 | ||||||
| 			TransferBuffer = TransferBuffer.Create<byte>(GraphicsDevice, TransferUsage.Buffer, VertexBuffer.Size + IndexBuffer.Size); | 			TransferBuffer = TransferBuffer.Create<byte>(GraphicsDevice, TransferUsage.Buffer, TransferBufferMapFlags.Write, VertexBuffer.Size + IndexBuffer.Size); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Call this to initialize or reset the batch. | 		// Call this to initialize or reset the batch. | ||||||
|  | @ -119,35 +119,35 @@ namespace MoonWorks.Graphics.Font | ||||||
| 			if (newTransferBufferNeeded) | 			if (newTransferBufferNeeded) | ||||||
| 			{ | 			{ | ||||||
| 				TransferBuffer.Dispose(); | 				TransferBuffer.Dispose(); | ||||||
| 				TransferBuffer = new TransferBuffer(GraphicsDevice, TransferUsage.Buffer, VertexBuffer.Size + IndexBuffer.Size); | 				TransferBuffer = new TransferBuffer(GraphicsDevice, TransferUsage.Buffer, TransferBufferMapFlags.Write, VertexBuffer.Size + IndexBuffer.Size); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0) | 			if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0) | ||||||
| 			{ | 			{ | ||||||
| 				TransferBuffer.SetData(vertexSpan, TransferOptions.Cycle); | 				TransferBuffer.SetData(vertexSpan, true); | ||||||
| 				TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Unsafe); | 				TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, false); | ||||||
| 
 | 
 | ||||||
| 				commandBuffer.BeginCopyPass(); | 				var copyPass = commandBuffer.BeginCopyPass(); | ||||||
| 				commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), WriteOptions.Cycle); | 				copyPass.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), true); | ||||||
| 				commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), WriteOptions.Cycle); | 				copyPass.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), true); | ||||||
| 				commandBuffer.EndCopyPass(); | 				commandBuffer.EndCopyPass(copyPass); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			PrimitiveCount = vertexCount / 2; | 			PrimitiveCount = vertexCount / 2; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// Call this AFTER binding your text pipeline! | 		// Call this AFTER binding your text pipeline! | ||||||
| 		public void Render(CommandBuffer commandBuffer, Math.Float.Matrix4x4 transformMatrix) | 		public void Render(RenderPass renderPass, Math.Float.Matrix4x4 transformMatrix) | ||||||
| 		{ | 		{ | ||||||
| 			commandBuffer.BindFragmentSamplers(new TextureSamplerBinding( | 			renderPass.BindFragmentSamplers(new TextureSamplerBinding( | ||||||
| 				CurrentFont.Texture, | 				CurrentFont.Texture, | ||||||
| 				GraphicsDevice.LinearSampler | 				GraphicsDevice.LinearSampler | ||||||
| 			)); | 			)); | ||||||
| 			commandBuffer.BindVertexBuffers(VertexBuffer); | 			renderPass.BindVertexBuffer(VertexBuffer); | ||||||
| 			commandBuffer.BindIndexBuffer(IndexBuffer, IndexElementSize.ThirtyTwo); | 			renderPass.BindIndexBuffer(IndexBuffer, IndexElementSize.ThirtyTwo); | ||||||
| 			commandBuffer.PushVertexShaderUniforms(transformMatrix); | 			renderPass.PushVertexUniformData(transformMatrix); | ||||||
| 			commandBuffer.PushFragmentShaderUniforms(CurrentFont.DistanceRange); | 			renderPass.PushFragmentUniformData(CurrentFont.DistanceRange); | ||||||
| 			commandBuffer.DrawIndexedPrimitives( | 			renderPass.DrawIndexedPrimitives( | ||||||
| 				0, | 				0, | ||||||
| 				0, | 				0, | ||||||
| 				PrimitiveCount | 				PrimitiveCount | ||||||
|  |  | ||||||
|  | @ -3,8 +3,7 @@ using System.Collections.Generic; | ||||||
| using System.IO; | using System.IO; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using MoonWorks.Video; | using MoonWorks.Video; | ||||||
| using SDL2; | using RefreshCS; | ||||||
| using SDL2_gpuCS; |  | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -17,9 +16,6 @@ namespace MoonWorks.Graphics | ||||||
| 		public BackendFlags Backend { get; } | 		public BackendFlags Backend { get; } | ||||||
| 		public bool DebugMode { get; } | 		public bool DebugMode { get; } | ||||||
| 
 | 
 | ||||||
| 		private uint windowFlags; |  | ||||||
| 		public SDL2.SDL.SDL_WindowFlags WindowFlags => (SDL2.SDL.SDL_WindowFlags) windowFlags; |  | ||||||
| 
 |  | ||||||
| 		// Built-in video pipeline | 		// Built-in video pipeline | ||||||
| 		internal GraphicsPipeline VideoPipeline { get; } | 		internal GraphicsPipeline VideoPipeline { get; } | ||||||
| 
 | 
 | ||||||
|  | @ -39,9 +35,9 @@ namespace MoonWorks.Graphics | ||||||
| 		private readonly HashSet<GCHandle> resources = new HashSet<GCHandle>(); | 		private readonly HashSet<GCHandle> resources = new HashSet<GCHandle>(); | ||||||
| 		private CommandBufferPool CommandBufferPool; | 		private CommandBufferPool CommandBufferPool; | ||||||
| 		private FencePool FencePool; | 		private FencePool FencePool; | ||||||
| 		internal RenderPassPool RenderPassPool; | 		internal RenderPassPool RenderPassPool = new RenderPassPool(); | ||||||
| 		internal ComputePassPool ComputePassPool; | 		internal ComputePassPool ComputePassPool = new ComputePassPool(); | ||||||
| 		internal CopyPassPool CopyPassPool; | 		internal CopyPassPool CopyPassPool = new CopyPassPool(); | ||||||
| 
 | 
 | ||||||
| 		internal unsafe GraphicsDevice( | 		internal unsafe GraphicsDevice( | ||||||
| 			BackendFlags preferredBackends, | 			BackendFlags preferredBackends, | ||||||
|  | @ -52,15 +48,15 @@ namespace MoonWorks.Graphics | ||||||
| 				throw new System.Exception("Could not set graphics backend!"); | 				throw new System.Exception("Could not set graphics backend!"); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			Handle = SDL_Gpu.SDL_GpuCreateDevice( | 			Handle = Refresh.Refresh_CreateDevice( | ||||||
| 				(SDL_Gpu.BackendFlags) preferredBackends, | 				(Refresh.BackendFlags) preferredBackends, | ||||||
| 				Conversions.BoolToByte(debugMode) | 				Conversions.BoolToByte(debugMode) | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			DebugMode = debugMode; | 			DebugMode = debugMode; | ||||||
| 			// TODO: check for CreateDevice fail | 			// TODO: check for CreateDevice fail | ||||||
| 
 | 
 | ||||||
| 			Backend = (BackendFlags) SDL_Gpu.SDL_GpuGetBackend(Handle); | 			Backend = (BackendFlags) Refresh.Refresh_GetBackend(Handle); | ||||||
| 
 | 
 | ||||||
| 			// Check for replacement stock shaders | 			// Check for replacement stock shaders | ||||||
| 			string basePath = System.AppContext.BaseDirectory; | 			string basePath = System.AppContext.BaseDirectory; | ||||||
|  | @ -257,11 +253,11 @@ namespace MoonWorks.Graphics | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			var success = Conversions.IntToBool( | 			var success = Conversions.IntToBool( | ||||||
| 				SDL_Gpu.SDL_GpuClaimWindow( | 				Refresh.Refresh_ClaimWindow( | ||||||
| 					Handle, | 					Handle, | ||||||
| 					window.Handle, | 					window.Handle, | ||||||
| 					(SDL_Gpu.SwapchainComposition) swapchainComposition, | 					(Refresh.SwapchainComposition) swapchainComposition, | ||||||
| 					(SDL_Gpu.PresentMode) presentMode | 					(Refresh.PresentMode) presentMode | ||||||
| 				) | 				) | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
|  | @ -287,7 +283,7 @@ namespace MoonWorks.Graphics | ||||||
| 		{ | 		{ | ||||||
| 			if (window.Claimed) | 			if (window.Claimed) | ||||||
| 			{ | 			{ | ||||||
| 				SDL_Gpu.SDL_GpuUnclaimWindow( | 				Refresh.Refresh_UnclaimWindow( | ||||||
| 					Handle, | 					Handle, | ||||||
| 					window.Handle | 					window.Handle | ||||||
| 				); | 				); | ||||||
|  | @ -316,11 +312,11 @@ namespace MoonWorks.Graphics | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuSetSwapchainParameters( | 			Refresh.Refresh_SetSwapchainParameters( | ||||||
| 				Handle, | 				Handle, | ||||||
| 				window.Handle, | 				window.Handle, | ||||||
| 				(SDL_Gpu.SwapchainComposition) swapchainComposition, | 				(Refresh.SwapchainComposition) swapchainComposition, | ||||||
| 				(SDL_Gpu.PresentMode) presentMode | 				(Refresh.PresentMode) presentMode | ||||||
| 			); | 			); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -332,7 +328,7 @@ namespace MoonWorks.Graphics | ||||||
| 		public CommandBuffer AcquireCommandBuffer() | 		public CommandBuffer AcquireCommandBuffer() | ||||||
| 		{ | 		{ | ||||||
| 			var commandBuffer = CommandBufferPool.Obtain(); | 			var commandBuffer = CommandBufferPool.Obtain(); | ||||||
| 			commandBuffer.SetHandle(SDL_Gpu.SDL_GpuAcquireCommandBuffer(Handle)); | 			commandBuffer.SetHandle(Refresh.Refresh_AcquireCommandBuffer(Handle)); | ||||||
| #if DEBUG | #if DEBUG | ||||||
| 			commandBuffer.ResetStateTracking(); | 			commandBuffer.ResetStateTracking(); | ||||||
| #endif | #endif | ||||||
|  | @ -351,7 +347,7 @@ namespace MoonWorks.Graphics | ||||||
| 			} | 			} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuSubmit( | 			Refresh.Refresh_Submit( | ||||||
| 				commandBuffer.Handle | 				commandBuffer.Handle | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
|  | @ -368,7 +364,7 @@ namespace MoonWorks.Graphics | ||||||
| 		/// <returns></returns> | 		/// <returns></returns> | ||||||
| 		public Fence SubmitAndAcquireFence(CommandBuffer commandBuffer) | 		public Fence SubmitAndAcquireFence(CommandBuffer commandBuffer) | ||||||
| 		{ | 		{ | ||||||
| 			var fenceHandle = SDL_Gpu.SDL_GpuSubmitAndAcquireFence( | 			var fenceHandle = Refresh.Refresh_SubmitAndAcquireFence( | ||||||
| 				commandBuffer.Handle | 				commandBuffer.Handle | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
|  | @ -383,7 +379,7 @@ namespace MoonWorks.Graphics | ||||||
| 		/// </summary> | 		/// </summary> | ||||||
| 		public void Wait() | 		public void Wait() | ||||||
| 		{ | 		{ | ||||||
| 			SDL_Gpu.SDL_GpuWait(Handle); | 			Refresh.Refresh_Wait(Handle); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		/// <summary> | 		/// <summary> | ||||||
|  | @ -393,7 +389,7 @@ namespace MoonWorks.Graphics | ||||||
| 		{ | 		{ | ||||||
| 			var fenceHandle = fence.Handle; | 			var fenceHandle = fence.Handle; | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuWaitForFences( | 			Refresh.Refresh_WaitForFences( | ||||||
| 				Handle, | 				Handle, | ||||||
| 				1, | 				1, | ||||||
| 				1, | 				1, | ||||||
|  | @ -414,7 +410,7 @@ namespace MoonWorks.Graphics | ||||||
| 			handlePtr[0] = fenceOne.Handle; | 			handlePtr[0] = fenceOne.Handle; | ||||||
| 			handlePtr[1] = fenceTwo.Handle; | 			handlePtr[1] = fenceTwo.Handle; | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuWaitForFences( | 			Refresh.Refresh_WaitForFences( | ||||||
| 				Handle, | 				Handle, | ||||||
| 				Conversions.BoolToInt(waitAll), | 				Conversions.BoolToInt(waitAll), | ||||||
| 				2, | 				2, | ||||||
|  | @ -437,7 +433,7 @@ namespace MoonWorks.Graphics | ||||||
| 			handlePtr[1] = fenceTwo.Handle; | 			handlePtr[1] = fenceTwo.Handle; | ||||||
| 			handlePtr[2] = fenceThree.Handle; | 			handlePtr[2] = fenceThree.Handle; | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuWaitForFences( | 			Refresh.Refresh_WaitForFences( | ||||||
| 				Handle, | 				Handle, | ||||||
| 				Conversions.BoolToInt(waitAll), | 				Conversions.BoolToInt(waitAll), | ||||||
| 				3, | 				3, | ||||||
|  | @ -462,7 +458,7 @@ namespace MoonWorks.Graphics | ||||||
| 			handlePtr[2] = fenceThree.Handle; | 			handlePtr[2] = fenceThree.Handle; | ||||||
| 			handlePtr[3] = fenceFour.Handle; | 			handlePtr[3] = fenceFour.Handle; | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuWaitForFences( | 			Refresh.Refresh_WaitForFences( | ||||||
| 				Handle, | 				Handle, | ||||||
| 				Conversions.BoolToInt(waitAll), | 				Conversions.BoolToInt(waitAll), | ||||||
| 				4, | 				4, | ||||||
|  | @ -483,7 +479,7 @@ namespace MoonWorks.Graphics | ||||||
| 				handlePtr[i] = fences[i].Handle; | 				handlePtr[i] = fences[i].Handle; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.SDL_GpuWaitForFences( | 			Refresh.Refresh_WaitForFences( | ||||||
| 				Handle, | 				Handle, | ||||||
| 				Conversions.BoolToInt(waitAll), | 				Conversions.BoolToInt(waitAll), | ||||||
| 				4, | 				4, | ||||||
|  | @ -497,7 +493,7 @@ namespace MoonWorks.Graphics | ||||||
| 		/// <exception cref="InvalidOperationException">Throws if the fence query indicates that the graphics device has been lost.</exception> | 		/// <exception cref="InvalidOperationException">Throws if the fence query indicates that the graphics device has been lost.</exception> | ||||||
| 		public bool QueryFence(Fence fence) | 		public bool QueryFence(Fence fence) | ||||||
| 		{ | 		{ | ||||||
| 			var result = SDL_Gpu.SDL_GpuQueryFence(Handle, fence.Handle); | 			var result = Refresh.Refresh_QueryFence(Handle, fence.Handle); | ||||||
| 
 | 
 | ||||||
| 			if (result < 0) | 			if (result < 0) | ||||||
| 			{ | 			{ | ||||||
|  | @ -512,7 +508,7 @@ namespace MoonWorks.Graphics | ||||||
| 		/// </summary> | 		/// </summary> | ||||||
| 		public void ReleaseFence(Fence fence) | 		public void ReleaseFence(Fence fence) | ||||||
| 		{ | 		{ | ||||||
| 			SDL_Gpu.SDL_GpuReleaseFence(Handle, fence.Handle); | 			Refresh.Refresh_ReleaseFence(Handle, fence.Handle); | ||||||
| 			fence.Handle = IntPtr.Zero; | 			fence.Handle = IntPtr.Zero; | ||||||
| 			FencePool.Return(fence); | 			FencePool.Return(fence); | ||||||
| 		} | 		} | ||||||
|  | @ -524,7 +520,7 @@ namespace MoonWorks.Graphics | ||||||
| 				throw new System.ArgumentException("Cannot get swapchain format of unclaimed window!"); | 				throw new System.ArgumentException("Cannot get swapchain format of unclaimed window!"); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			return (TextureFormat) SDL_Gpu.SDL_GpuGetSwapchainTextureFormat(Handle, window.Handle); | 			return (TextureFormat) Refresh.Refresh_GetSwapchainTextureFormat(Handle, window.Handle); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		internal void AddResourceReference(GCHandle resourceReference) | 		internal void AddResourceReference(GCHandle resourceReference) | ||||||
|  | @ -572,7 +568,7 @@ namespace MoonWorks.Graphics | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				SDL_Gpu.SDL_GpuDestroyDevice(Handle); | 				Refresh.Refresh_DestroyDevice(Handle); | ||||||
| 
 | 
 | ||||||
| 				IsDisposed = true; | 				IsDisposed = true; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ namespace MoonWorks.Graphics | ||||||
| 			{ | 			{ | ||||||
| 				var pixelData = | 				var pixelData = | ||||||
| 					Refresh.Refresh_Image_Load( | 					Refresh.Refresh_Image_Load( | ||||||
| 					(nint) ptr, | 					ptr, | ||||||
| 					data.Length, | 					data.Length, | ||||||
| 					out var w, | 					out var w, | ||||||
| 					out var h, | 					out var h, | ||||||
|  | @ -34,7 +34,7 @@ namespace MoonWorks.Graphics | ||||||
| 				height = (uint) h; | 				height = (uint) h; | ||||||
| 				sizeInBytes = (uint) len; | 				sizeInBytes = (uint) len; | ||||||
| 
 | 
 | ||||||
| 				return pixelData; | 				return (nint) pixelData; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -89,7 +89,7 @@ namespace MoonWorks.Graphics | ||||||
| 			{ | 			{ | ||||||
| 				var result = | 				var result = | ||||||
| 					Refresh.Refresh_Image_Info( | 					Refresh.Refresh_Image_Info( | ||||||
| 					(nint) ptr, | 					ptr, | ||||||
| 					data.Length, | 					data.Length, | ||||||
| 					out var w, | 					out var w, | ||||||
| 					out var h, | 					out var h, | ||||||
|  | @ -100,7 +100,7 @@ namespace MoonWorks.Graphics | ||||||
| 				height = (uint) h; | 				height = (uint) h; | ||||||
| 				sizeInBytes = (uint) len; | 				sizeInBytes = (uint) len; | ||||||
| 
 | 
 | ||||||
| 				return Conversions.ByteToBool(result); | 				return Conversions.IntToBool(result); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -141,9 +141,9 @@ namespace MoonWorks.Graphics | ||||||
| 		/// <summary> | 		/// <summary> | ||||||
| 		/// Frees pixel data obtained from GetPixelData methods. | 		/// Frees pixel data obtained from GetPixelData methods. | ||||||
| 		/// </summary> | 		/// </summary> | ||||||
| 		public static void FreePixelData(IntPtr pixels) | 		public unsafe static void FreePixelData(IntPtr pixels) | ||||||
| 		{ | 		{ | ||||||
| 			Refresh.Refresh_Image_Free(pixels); | 			Refresh.Refresh_Image_Free((byte*) pixels); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		/// <summary> | 		/// <summary> | ||||||
|  | @ -159,7 +159,7 @@ namespace MoonWorks.Graphics | ||||||
| 		) { | 		) { | ||||||
| 			var sizeInBytes = width * height * 4; | 			var sizeInBytes = width * height * 4; | ||||||
| 
 | 
 | ||||||
| 			var pixelsPtr = NativeMemory.Alloc((nuint) sizeInBytes); | 			var pixelsPtr = (byte*) NativeMemory.Alloc((nuint) sizeInBytes); | ||||||
| 			var pixelsSpan = new Span<byte>(pixelsPtr, sizeInBytes); | 			var pixelsSpan = new Span<byte>(pixelsPtr, sizeInBytes); | ||||||
| 
 | 
 | ||||||
| 			transferBuffer.GetData(pixelsSpan, bufferOffsetInBytes); | 			transferBuffer.GetData(pixelsSpan, bufferOffsetInBytes); | ||||||
|  | @ -167,7 +167,7 @@ namespace MoonWorks.Graphics | ||||||
| 			if (bgra) | 			if (bgra) | ||||||
| 			{ | 			{ | ||||||
| 				// if data is bgra, we have to swap the R and B channels | 				// if data is bgra, we have to swap the R and B channels | ||||||
| 				var rgbaPtr = NativeMemory.Alloc((nuint) sizeInBytes); | 				var rgbaPtr = (byte*) NativeMemory.Alloc((nuint) sizeInBytes); | ||||||
| 				var rgbaSpan = new Span<byte>(rgbaPtr, sizeInBytes); | 				var rgbaSpan = new Span<byte>(rgbaPtr, sizeInBytes); | ||||||
| 
 | 
 | ||||||
| 				for (var i = 0; i < sizeInBytes; i += 4) | 				for (var i = 0; i < sizeInBytes; i += 4) | ||||||
|  | @ -182,7 +182,7 @@ namespace MoonWorks.Graphics | ||||||
| 				pixelsPtr = rgbaPtr; | 				pixelsPtr = rgbaPtr; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			Refresh.Refresh_Image_SavePNG(path, (nint) pixelsPtr, width, height); | 			Refresh.Refresh_Image_SavePNG(path, pixelsPtr, width, height); | ||||||
| 			NativeMemory.Free(pixelsPtr); | 			NativeMemory.Free(pixelsPtr); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,14 +3,14 @@ using System.Threading; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
| public abstract class SDL_GpuResource : GraphicsResource | public abstract class RefreshResource : GraphicsResource | ||||||
| { | { | ||||||
| 	public IntPtr Handle { get => handle; internal set => handle = value; } | 	public IntPtr Handle { get => handle; internal set => handle = value; } | ||||||
| 	private IntPtr handle; | 	private IntPtr handle; | ||||||
| 
 | 
 | ||||||
| 	protected abstract Action<IntPtr, IntPtr> ReleaseFunction { get; } | 	protected abstract Action<IntPtr, IntPtr> ReleaseFunction { get; } | ||||||
| 
 | 
 | ||||||
| 	protected SDL_GpuResource(GraphicsDevice device) : base(device) | 	protected RefreshResource(GraphicsDevice device) : base(device) | ||||||
| 	{ | 	{ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| using System; | using System; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
| // Recreate certain types in here so we can hide the SDL_GpuCS namespace | // Recreate certain types in here so we can hide the Refresh namespace | ||||||
| 
 | 
 | ||||||
| public enum PrimitiveType | public enum PrimitiveType | ||||||
| { | { | ||||||
|  | @ -334,9 +334,9 @@ public struct DepthStencilValue | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// FIXME: can we do an unsafe cast somehow? | 	// FIXME: can we do an unsafe cast somehow? | ||||||
| 	public SDL_Gpu.DepthStencilValue ToSDL() | 	public Refresh.DepthStencilValue ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.DepthStencilValue | 		return new Refresh.DepthStencilValue | ||||||
| 		{ | 		{ | ||||||
| 			Depth = Depth, | 			Depth = Depth, | ||||||
| 			Stencil = Stencil | 			Stencil = Stencil | ||||||
|  | @ -369,9 +369,9 @@ public struct Rect | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// FIXME: can we do an unsafe cast somehow? | 	// FIXME: can we do an unsafe cast somehow? | ||||||
| 	public SDL_Gpu.Rect ToSDL() | 	public Refresh.Rect ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.Rect | 		return new Refresh.Rect | ||||||
| 		{ | 		{ | ||||||
| 			X = X, | 			X = X, | ||||||
| 			Y = Y, | 			Y = Y, | ||||||
|  | @ -421,9 +421,9 @@ public struct Viewport | ||||||
| 		MaxDepth = maxDepth; | 		MaxDepth = maxDepth; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.Viewport ToSDL() | 	public Refresh.Viewport ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.Viewport | 		return new Refresh.Viewport | ||||||
| 		{ | 		{ | ||||||
| 			X = X, | 			X = X, | ||||||
| 			Y = Y, | 			Y = Y, | ||||||
|  | @ -452,13 +452,13 @@ public struct VertexBinding | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.VertexBinding ToSDL() | 	public Refresh.VertexBinding ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.VertexBinding | 		return new Refresh.VertexBinding | ||||||
| 		{ | 		{ | ||||||
| 			Binding = Binding, | 			Binding = Binding, | ||||||
| 			Stride = Stride, | 			Stride = Stride, | ||||||
| 			InputRate = (SDL_Gpu.VertexInputRate) InputRate | 			InputRate = (Refresh.VertexInputRate) InputRate | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -471,13 +471,13 @@ public struct VertexAttribute | ||||||
| 	public VertexElementFormat Format; | 	public VertexElementFormat Format; | ||||||
| 	public uint Offset; | 	public uint Offset; | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.VertexAttribute ToSDL() | 	public Refresh.VertexAttribute ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.VertexAttribute | 		return new Refresh.VertexAttribute | ||||||
| 		{ | 		{ | ||||||
| 			Location = Location, | 			Location = Location, | ||||||
| 			Binding = Binding, | 			Binding = Binding, | ||||||
| 			Format = (SDL_Gpu.VertexElementFormat) Format, | 			Format = (Refresh.VertexElementFormat) Format, | ||||||
| 			Offset = Offset | 			Offset = Offset | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
|  | @ -491,14 +491,14 @@ public struct StencilOpState | ||||||
| 	public StencilOp DepthFailOp; | 	public StencilOp DepthFailOp; | ||||||
| 	public CompareOp CompareOp; | 	public CompareOp CompareOp; | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.StencilOpState ToSDL() | 	public Refresh.StencilOpState ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.StencilOpState | 		return new Refresh.StencilOpState | ||||||
| 		{ | 		{ | ||||||
| 			FailOp = (SDL_Gpu.StencilOp) FailOp, | 			FailOp = (Refresh.StencilOp) FailOp, | ||||||
| 			PassOp = (SDL_Gpu.StencilOp) PassOp, | 			PassOp = (Refresh.StencilOp) PassOp, | ||||||
| 			DepthFailOp = (SDL_Gpu.StencilOp) DepthFailOp, | 			DepthFailOp = (Refresh.StencilOp) DepthFailOp, | ||||||
| 			CompareOp = (SDL_Gpu.CompareOp) CompareOp | 			CompareOp = (Refresh.CompareOp) CompareOp | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -574,20 +574,20 @@ public struct ColorAttachmentInfo | ||||||
| 		Cycle = cycle; | 		Cycle = cycle; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.ColorAttachmentInfo ToSDL() | 	public Refresh.ColorAttachmentInfo ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.ColorAttachmentInfo | 		return new Refresh.ColorAttachmentInfo | ||||||
| 		{ | 		{ | ||||||
| 			TextureSlice = TextureSlice.ToSDL(), | 			TextureSlice = TextureSlice.ToRefresh(), | ||||||
| 			ClearColor = new SDL_Gpu.Color | 			ClearColor = new Refresh.Color | ||||||
| 			{ | 			{ | ||||||
| 				R = ClearColor.R / 255f, | 				R = ClearColor.R / 255f, | ||||||
| 				G = ClearColor.G / 255f, | 				G = ClearColor.G / 255f, | ||||||
| 				B = ClearColor.B / 255f, | 				B = ClearColor.B / 255f, | ||||||
| 				A = ClearColor.A / 255f | 				A = ClearColor.A / 255f | ||||||
| 			}, | 			}, | ||||||
| 			LoadOp = (SDL_Gpu.LoadOp) LoadOp, | 			LoadOp = (Refresh.LoadOp) LoadOp, | ||||||
| 			StoreOp = (SDL_Gpu.StoreOp) StoreOp, | 			StoreOp = (Refresh.StoreOp) StoreOp, | ||||||
| 			Cycle = Conversions.BoolToInt(Cycle) | 			Cycle = Conversions.BoolToInt(Cycle) | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
|  | @ -720,16 +720,16 @@ public struct DepthStencilAttachmentInfo | ||||||
| 		Cycle = cycle; | 		Cycle = cycle; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.DepthStencilAttachmentInfo ToSDL() | 	public Refresh.DepthStencilAttachmentInfo ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.DepthStencilAttachmentInfo | 		return new Refresh.DepthStencilAttachmentInfo | ||||||
| 		{ | 		{ | ||||||
| 			TextureSlice = TextureSlice.ToSDL(), | 			TextureSlice = TextureSlice.ToRefresh(), | ||||||
| 			DepthStencilClearValue = DepthStencilClearValue.ToSDL(), | 			DepthStencilClearValue = DepthStencilClearValue.ToRefresh(), | ||||||
| 			LoadOp = (SDL_Gpu.LoadOp) LoadOp, | 			LoadOp = (Refresh.LoadOp) LoadOp, | ||||||
| 			StoreOp = (SDL_Gpu.StoreOp) StoreOp, | 			StoreOp = (Refresh.StoreOp) StoreOp, | ||||||
| 			StencilLoadOp = (SDL_Gpu.LoadOp) StencilLoadOp, | 			StencilLoadOp = (Refresh.LoadOp) StencilLoadOp, | ||||||
| 			StencilStoreOp = (SDL_Gpu.StoreOp) StencilStoreOp, | 			StencilStoreOp = (Refresh.StoreOp) StencilStoreOp, | ||||||
| 			Cycle = Conversions.BoolToInt(Cycle) | 			Cycle = Conversions.BoolToInt(Cycle) | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
|  | @ -788,9 +788,9 @@ public struct BufferCopy | ||||||
| 		Size = size; | 		Size = size; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.BufferCopy ToSDL() | 	public Refresh.BufferCopy ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.BufferCopy | 		return new Refresh.BufferCopy | ||||||
| 		{ | 		{ | ||||||
| 			SourceOffset = SrcOffset, | 			SourceOffset = SrcOffset, | ||||||
| 			DestinationOffset = DstOffset, | 			DestinationOffset = DstOffset, | ||||||
|  | @ -811,9 +811,9 @@ public readonly record struct BufferImageCopy( | ||||||
| 	uint BufferStride, | 	uint BufferStride, | ||||||
| 	uint BufferImageHeight | 	uint BufferImageHeight | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.BufferImageCopy ToSDL() | 	public Refresh.BufferImageCopy ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.BufferImageCopy | 		return new Refresh.BufferImageCopy | ||||||
| 		{ | 		{ | ||||||
| 			BufferOffset = BufferOffset, | 			BufferOffset = BufferOffset, | ||||||
| 			BufferStride = BufferStride, | 			BufferStride = BufferStride, | ||||||
|  | @ -828,9 +828,9 @@ public readonly record struct GraphicsPipelineResourceInfo( | ||||||
| 	uint StorageTextureCount, | 	uint StorageTextureCount, | ||||||
| 	uint UniformBufferCount | 	uint UniformBufferCount | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.GraphicsPipelineResourceInfo ToSDL() | 	public Refresh.GraphicsPipelineResourceInfo ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.GraphicsPipelineResourceInfo | 		return new Refresh.GraphicsPipelineResourceInfo | ||||||
| 		{ | 		{ | ||||||
| 			SamplerCount = SamplerCount, | 			SamplerCount = SamplerCount, | ||||||
| 			StorageBufferCount = StorageBufferCount, | 			StorageBufferCount = StorageBufferCount, | ||||||
|  | @ -847,9 +847,9 @@ public readonly record struct ComputePipelineResourceInfo( | ||||||
| 	uint ReadWriteStorageBufferCount, | 	uint ReadWriteStorageBufferCount, | ||||||
| 	uint UniformBufferCount | 	uint UniformBufferCount | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.ComputePipelineResourceInfo ToSDL() | 	public Refresh.ComputePipelineResourceInfo ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.ComputePipelineResourceInfo | 		return new Refresh.ComputePipelineResourceInfo | ||||||
| 		{ | 		{ | ||||||
| 			ReadOnlyStorageTextureCount = ReadOnlyStorageTextureCount, | 			ReadOnlyStorageTextureCount = ReadOnlyStorageTextureCount, | ||||||
| 			ReadOnlyStorageBufferCount = ReadOnlyStorageBufferCount, | 			ReadOnlyStorageBufferCount = ReadOnlyStorageBufferCount, | ||||||
|  | @ -867,9 +867,9 @@ public readonly record struct BufferBinding( | ||||||
| 	GpuBuffer Buffer, | 	GpuBuffer Buffer, | ||||||
| 	uint Offset | 	uint Offset | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.BufferBinding ToSDL() | 	public Refresh.BufferBinding ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.BufferBinding | 		return new Refresh.BufferBinding | ||||||
| 		{ | 		{ | ||||||
| 			Buffer = Buffer.Handle, | 			Buffer = Buffer.Handle, | ||||||
| 			Offset = Offset | 			Offset = Offset | ||||||
|  | @ -884,9 +884,9 @@ public readonly record struct TextureSamplerBinding( | ||||||
| 	Texture Texture, | 	Texture Texture, | ||||||
| 	Sampler Sampler | 	Sampler Sampler | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.TextureSamplerBinding ToSDL() | 	public Refresh.TextureSamplerBinding ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.TextureSamplerBinding | 		return new Refresh.TextureSamplerBinding | ||||||
| 		{ | 		{ | ||||||
| 			Texture = Texture.Handle, | 			Texture = Texture.Handle, | ||||||
| 			Sampler = Sampler.Handle | 			Sampler = Sampler.Handle | ||||||
|  | @ -898,9 +898,9 @@ public readonly record struct StorageBufferReadWriteBinding( | ||||||
| 	GpuBuffer Buffer, | 	GpuBuffer Buffer, | ||||||
| 	bool cycle | 	bool cycle | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.StorageBufferReadWriteBinding ToSDL() | 	public Refresh.StorageBufferReadWriteBinding ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.StorageBufferReadWriteBinding | 		return new Refresh.StorageBufferReadWriteBinding | ||||||
| 		{ | 		{ | ||||||
| 			Buffer = Buffer.Handle, | 			Buffer = Buffer.Handle, | ||||||
| 			Cycle = Conversions.BoolToInt(cycle) | 			Cycle = Conversions.BoolToInt(cycle) | ||||||
|  | @ -912,11 +912,11 @@ public readonly record struct StorageTextureReadWriteBinding( | ||||||
| 	in TextureSlice TextureSlice, | 	in TextureSlice TextureSlice, | ||||||
| 	bool cycle | 	bool cycle | ||||||
| ) { | ) { | ||||||
| 	public SDL_Gpu.StorageTextureReadWriteBinding ToSDL() | 	public Refresh.StorageTextureReadWriteBinding ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.StorageTextureReadWriteBinding | 		return new Refresh.StorageTextureReadWriteBinding | ||||||
| 		{ | 		{ | ||||||
| 			TextureSlice = TextureSlice.ToSDL(), | 			TextureSlice = TextureSlice.ToRefresh(), | ||||||
| 			Cycle = Conversions.BoolToInt(cycle) | 			Cycle = Conversions.BoolToInt(cycle) | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| using System; | using System; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
| /// <summary> | /// <summary> | ||||||
|  | @ -59,7 +59,7 @@ public class RenderPass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindGraphicsPipeline( | 		Refresh.Refresh_BindGraphicsPipeline( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			graphicsPipeline.Handle | 			graphicsPipeline.Handle | ||||||
| 		); | 		); | ||||||
|  | @ -78,9 +78,9 @@ public class RenderPass | ||||||
| 		AssertRenderPassActive(); | 		AssertRenderPassActive(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuSetViewport( | 		Refresh.Refresh_SetViewport( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			viewport.ToSDL() | 			viewport.ToRefresh() | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -98,9 +98,9 @@ public class RenderPass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuSetScissor( | 		Refresh.Refresh_SetScissor( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			scissor.ToSDL() | 			scissor.ToRefresh() | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -117,9 +117,9 @@ public class RenderPass | ||||||
| 		AssertGraphicsPipelineBound(); | 		AssertGraphicsPipelineBound(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlBufferBinding = bufferBinding.ToSDL(); | 		var sdlBufferBinding = bufferBinding.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindVertexBuffers( | 		Refresh.Refresh_BindVertexBuffers( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			firstBinding, | 			firstBinding, | ||||||
| 			&sdlBufferBinding, | 			&sdlBufferBinding, | ||||||
|  | @ -142,10 +142,10 @@ public class RenderPass | ||||||
| 		AssertGraphicsPipelineBound(); | 		AssertGraphicsPipelineBound(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindIndexBuffer( | 		Refresh.Refresh_BindIndexBuffer( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			bufferBinding.ToSDL(), | 			bufferBinding.ToRefresh(), | ||||||
| 			(SDL_Gpu.IndexElementSize) indexElementSize | 			(Refresh.IndexElementSize) indexElementSize | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -163,9 +163,9 @@ public class RenderPass | ||||||
| 		AssertTextureHasSamplerFlag(textureSamplerBinding.Texture); | 		AssertTextureHasSamplerFlag(textureSamplerBinding.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureSamplerBinding = textureSamplerBinding.ToSDL(); | 		var sdlTextureSamplerBinding = textureSamplerBinding.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindVertexSamplers( | 		Refresh.Refresh_BindVertexSamplers( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&sdlTextureSamplerBinding, | 			&sdlTextureSamplerBinding, | ||||||
|  | @ -183,9 +183,9 @@ public class RenderPass | ||||||
| 		AssertTextureHasGraphicsStorageFlag(textureSlice.Texture); | 		AssertTextureHasGraphicsStorageFlag(textureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureSlice = textureSlice.ToSDL(); | 		var sdlTextureSlice = textureSlice.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindVertexStorageTextures( | 		Refresh.Refresh_BindVertexStorageTextures( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&sdlTextureSlice, | 			&sdlTextureSlice, | ||||||
|  | @ -205,7 +205,7 @@ public class RenderPass | ||||||
| 
 | 
 | ||||||
| 		var bufferHandle = buffer.Handle; | 		var bufferHandle = buffer.Handle; | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindVertexStorageBuffers( | 		Refresh.Refresh_BindVertexStorageBuffers( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&bufferHandle, | 			&bufferHandle, | ||||||
|  | @ -223,9 +223,9 @@ public class RenderPass | ||||||
| 		AssertTextureHasSamplerFlag(textureSamplerBinding.Texture); | 		AssertTextureHasSamplerFlag(textureSamplerBinding.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureSamplerBinding = textureSamplerBinding.ToSDL(); | 		var sdlTextureSamplerBinding = textureSamplerBinding.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindFragmentSamplers( | 		Refresh.Refresh_BindFragmentSamplers( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&sdlTextureSamplerBinding, | 			&sdlTextureSamplerBinding, | ||||||
|  | @ -243,9 +243,9 @@ public class RenderPass | ||||||
| 		AssertTextureHasGraphicsStorageFlag(textureSlice.Texture); | 		AssertTextureHasGraphicsStorageFlag(textureSlice.Texture); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		var sdlTextureSlice = textureSlice.ToSDL(); | 		var sdlTextureSlice = textureSlice.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindFragmentStorageTextures( | 		Refresh.Refresh_BindFragmentStorageTextures( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&sdlTextureSlice, | 			&sdlTextureSlice, | ||||||
|  | @ -265,7 +265,7 @@ public class RenderPass | ||||||
| 
 | 
 | ||||||
| 		var bufferHandle = buffer.Handle; | 		var bufferHandle = buffer.Handle; | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuBindFragmentStorageBuffers( | 		Refresh.Refresh_BindFragmentStorageBuffers( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			&bufferHandle, | 			&bufferHandle, | ||||||
|  | @ -287,7 +287,7 @@ public class RenderPass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuPushVertexUniformData( | 		Refresh.Refresh_PushVertexUniformData( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			(nint) uniformsPtr, | 			(nint) uniformsPtr, | ||||||
|  | @ -320,7 +320,7 @@ public class RenderPass | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuPushFragmentUniformData( | 		Refresh.Refresh_PushFragmentUniformData( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			slot, | 			slot, | ||||||
| 			(nint) uniformsPtr, | 			(nint) uniformsPtr, | ||||||
|  | @ -356,7 +356,7 @@ public class RenderPass | ||||||
| 		AssertGraphicsPipelineBound(); | 		AssertGraphicsPipelineBound(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuDrawIndexedPrimitives( | 		Refresh.Refresh_DrawIndexedPrimitives( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			baseVertex, | 			baseVertex, | ||||||
| 			startIndex, | 			startIndex, | ||||||
|  | @ -380,7 +380,7 @@ public class RenderPass | ||||||
| 		AssertGraphicsPipelineBound(); | 		AssertGraphicsPipelineBound(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuDrawPrimitives( | 		Refresh.Refresh_DrawPrimitives( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			vertexStart, | 			vertexStart, | ||||||
| 			primitiveCount | 			primitiveCount | ||||||
|  | @ -405,7 +405,7 @@ public class RenderPass | ||||||
| 		AssertGraphicsPipelineBound(); | 		AssertGraphicsPipelineBound(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuDrawPrimitivesIndirect( | 		Refresh.Refresh_DrawPrimitivesIndirect( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			buffer.Handle, | 			buffer.Handle, | ||||||
| 			offsetInBytes, | 			offsetInBytes, | ||||||
|  | @ -432,7 +432,7 @@ public class RenderPass | ||||||
| 		AssertGraphicsPipelineBound(); | 		AssertGraphicsPipelineBound(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		SDL_Gpu.SDL_GpuDrawIndexedPrimitivesIndirect( | 		Refresh.Refresh_DrawIndexedPrimitivesIndirect( | ||||||
| 			Handle, | 			Handle, | ||||||
| 			buffer.Handle, | 			buffer.Handle, | ||||||
| 			offsetInBytes, | 			offsetInBytes, | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| using System; | using System; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
|  | @ -6,9 +6,9 @@ namespace MoonWorks.Graphics | ||||||
| 	/// <summary> | 	/// <summary> | ||||||
| 	/// Compute pipelines perform arbitrary parallel processing on input data. | 	/// Compute pipelines perform arbitrary parallel processing on input data. | ||||||
| 	/// </summary> | 	/// </summary> | ||||||
| 	public class ComputePipeline : SDL_GpuResource | 	public class ComputePipeline : RefreshResource | ||||||
| 	{ | 	{ | ||||||
| 		protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseComputePipeline; | 		protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseComputePipeline; | ||||||
| 
 | 
 | ||||||
| 		public ComputePipelineResourceInfo ResourceInfo { get; } | 		public ComputePipelineResourceInfo ResourceInfo { get; } | ||||||
| 
 | 
 | ||||||
|  | @ -18,13 +18,13 @@ namespace MoonWorks.Graphics | ||||||
| 			ComputePipelineResourceInfo resourceInfo | 			ComputePipelineResourceInfo resourceInfo | ||||||
| 		) : base(device) | 		) : base(device) | ||||||
| 		{ | 		{ | ||||||
| 			var sdlComputePipelineCreateInfo = new SDL_Gpu.ComputePipelineCreateInfo | 			var sdlComputePipelineCreateInfo = new Refresh.ComputePipelineCreateInfo | ||||||
| 			{ | 			{ | ||||||
| 				ComputeShader = computeShader.Handle, | 				ComputeShader = computeShader.Handle, | ||||||
| 				PipelineResourceInfo = resourceInfo.ToSDL() | 				PipelineResourceInfo = resourceInfo.ToRefresh() | ||||||
| 			}; | 			}; | ||||||
| 
 | 
 | ||||||
| 			Handle = SDL_Gpu.SDL_GpuCreateComputePipeline( | 			Handle = Refresh.Refresh_CreateComputePipeline( | ||||||
| 				device.Handle, | 				device.Handle, | ||||||
| 				sdlComputePipelineCreateInfo | 				sdlComputePipelineCreateInfo | ||||||
| 			); | 			); | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| using System; | using System; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
|  | @ -10,9 +10,9 @@ namespace MoonWorks.Graphics; | ||||||
| /// The Fence object itself is basically just a wrapper for the Refresh_Fence. <br/> | /// The Fence object itself is basically just a wrapper for the Refresh_Fence. <br/> | ||||||
| /// The internal handle is replaced so that we can pool Fence objects to manage garbage. | /// The internal handle is replaced so that we can pool Fence objects to manage garbage. | ||||||
| /// </summary> | /// </summary> | ||||||
| public class Fence : SDL_GpuResource | public class Fence : RefreshResource | ||||||
| { | { | ||||||
| 	protected override Action<nint, nint> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseFence; | 	protected override Action<nint, nint> ReleaseFunction => Refresh.Refresh_ReleaseFence; | ||||||
| 
 | 
 | ||||||
| 	internal Fence(GraphicsDevice device) : base(device) | 	internal Fence(GraphicsDevice device) : base(device) | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|  | @ -1,15 +1,15 @@ | ||||||
| using System; | using System; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
| /// <summary> | /// <summary> | ||||||
| /// GpuBuffers are generic data containers that can be used by the GPU. | /// GpuBuffers are generic data containers that can be used by the GPU. | ||||||
| /// </summary> | /// </summary> | ||||||
| public class GpuBuffer : SDL_GpuResource | public class GpuBuffer : RefreshResource | ||||||
| { | { | ||||||
| 	protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseBuffer; | 	protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseBuffer; | ||||||
| 
 | 
 | ||||||
| 	public BufferUsageFlags UsageFlags { get; } | 	public BufferUsageFlags UsageFlags { get; } | ||||||
| 
 | 
 | ||||||
|  | @ -27,7 +27,7 @@ public class GpuBuffer : SDL_GpuResource | ||||||
| 		{ | 		{ | ||||||
| 			if (Device.DebugMode) | 			if (Device.DebugMode) | ||||||
| 			{ | 			{ | ||||||
| 				SDL_Gpu.SDL_GpuSetBufferName( | 				Refresh.Refresh_SetBufferName( | ||||||
| 					Device.Handle, | 					Device.Handle, | ||||||
| 					Handle, | 					Handle, | ||||||
| 					value | 					value | ||||||
|  | @ -71,9 +71,9 @@ public class GpuBuffer : SDL_GpuResource | ||||||
| 		uint sizeInBytes | 		uint sizeInBytes | ||||||
| 	) : base(device) | 	) : base(device) | ||||||
| 	{ | 	{ | ||||||
| 		Handle = SDL_Gpu.SDL_GpuCreateBuffer( | 		Handle = Refresh.Refresh_CreateBuffer( | ||||||
| 			device.Handle, | 			device.Handle, | ||||||
| 			(SDL_Gpu.BufferUsageFlags) usageFlags, | 			(Refresh.BufferUsageFlags) usageFlags, | ||||||
| 			sizeInBytes | 			sizeInBytes | ||||||
| 		); | 		); | ||||||
| 		UsageFlags = usageFlags; | 		UsageFlags = usageFlags; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| using System; | using System; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -8,9 +8,9 @@ namespace MoonWorks.Graphics | ||||||
| 	/// Graphics pipelines encapsulate all of the render state in a single object. <br/> | 	/// Graphics pipelines encapsulate all of the render state in a single object. <br/> | ||||||
| 	/// These pipelines are bound before draw calls are issued. | 	/// These pipelines are bound before draw calls are issued. | ||||||
| 	/// </summary> | 	/// </summary> | ||||||
| 	public class GraphicsPipeline : SDL_GpuResource | 	public class GraphicsPipeline : RefreshResource | ||||||
| 	{ | 	{ | ||||||
| 		protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseGraphicsPipeline; | 		protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseGraphicsPipeline; | ||||||
| 
 | 
 | ||||||
| 		public GraphicsPipelineResourceInfo VertexShaderResourceInfo { get; } | 		public GraphicsPipelineResourceInfo VertexShaderResourceInfo { get; } | ||||||
| 		public GraphicsPipelineResourceInfo FragmentShaderResourceInfo { get; } | 		public GraphicsPipelineResourceInfo FragmentShaderResourceInfo { get; } | ||||||
|  | @ -25,34 +25,34 @@ namespace MoonWorks.Graphics | ||||||
| 			in GraphicsPipelineCreateInfo graphicsPipelineCreateInfo | 			in GraphicsPipelineCreateInfo graphicsPipelineCreateInfo | ||||||
| 		) : base(device) | 		) : base(device) | ||||||
| 		{ | 		{ | ||||||
| 			SDL_Gpu.GraphicsPipelineCreateInfo sdlGraphicsPipelineCreateInfo; | 			Refresh.GraphicsPipelineCreateInfo sdlGraphicsPipelineCreateInfo; | ||||||
| 
 | 
 | ||||||
| 			var vertexAttributes = (SDL_Gpu.VertexAttribute*) NativeMemory.Alloc( | 			var vertexAttributes = (Refresh.VertexAttribute*) NativeMemory.Alloc( | ||||||
| 				(nuint) (graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length * Marshal.SizeOf<SDL_Gpu.VertexAttribute>()) | 				(nuint) (graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length * Marshal.SizeOf<Refresh.VertexAttribute>()) | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			for (var i = 0; i < graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length; i += 1) | 			for (var i = 0; i < graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length; i += 1) | ||||||
| 			{ | 			{ | ||||||
| 				vertexAttributes[i] = graphicsPipelineCreateInfo.VertexInputState.VertexAttributes[i].ToSDL(); | 				vertexAttributes[i] = graphicsPipelineCreateInfo.VertexInputState.VertexAttributes[i].ToRefresh(); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			var vertexBindings = (SDL_Gpu.VertexBinding*) NativeMemory.Alloc( | 			var vertexBindings = (Refresh.VertexBinding*) NativeMemory.Alloc( | ||||||
| 				(nuint) (graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length * Marshal.SizeOf<SDL_Gpu.VertexBinding>()) | 				(nuint) (graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length * Marshal.SizeOf<Refresh.VertexBinding>()) | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			for (var i = 0; i < graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length; i += 1) | 			for (var i = 0; i < graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length; i += 1) | ||||||
| 			{ | 			{ | ||||||
| 				vertexBindings[i] = graphicsPipelineCreateInfo.VertexInputState.VertexBindings[i].ToSDL(); | 				vertexBindings[i] = graphicsPipelineCreateInfo.VertexInputState.VertexBindings[i].ToRefresh(); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			var colorAttachmentDescriptions = stackalloc SDL_Gpu.ColorAttachmentDescription[ | 			var colorAttachmentDescriptions = stackalloc Refresh.ColorAttachmentDescription[ | ||||||
| 				graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length | 				graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length | ||||||
| 			]; | 			]; | ||||||
| 
 | 
 | ||||||
| 			for (var i = 0; i < graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length; i += 1) | 			for (var i = 0; i < graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length; i += 1) | ||||||
| 			{ | 			{ | ||||||
| 				colorAttachmentDescriptions[i].Format = (SDL_Gpu.TextureFormat) graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[i].Format; | 				colorAttachmentDescriptions[i].Format = (Refresh.TextureFormat) graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[i].Format; | ||||||
| 				colorAttachmentDescriptions[i].BlendState = graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[i].BlendState.ToSDL(); | 				colorAttachmentDescriptions[i].BlendState = graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[i].BlendState.ToRefresh(); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			sdlGraphicsPipelineCreateInfo.VertexShader = graphicsPipelineCreateInfo.VertexShader.Handle; | 			sdlGraphicsPipelineCreateInfo.VertexShader = graphicsPipelineCreateInfo.VertexShader.Handle; | ||||||
|  | @ -63,26 +63,26 @@ namespace MoonWorks.Graphics | ||||||
| 			sdlGraphicsPipelineCreateInfo.VertexInputState.VertexBindings = vertexBindings; | 			sdlGraphicsPipelineCreateInfo.VertexInputState.VertexBindings = vertexBindings; | ||||||
| 			sdlGraphicsPipelineCreateInfo.VertexInputState.VertexBindingCount = (uint) graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length; | 			sdlGraphicsPipelineCreateInfo.VertexInputState.VertexBindingCount = (uint) graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length; | ||||||
| 
 | 
 | ||||||
| 			sdlGraphicsPipelineCreateInfo.PrimitiveType = (SDL_Gpu.PrimitiveType) graphicsPipelineCreateInfo.PrimitiveType; | 			sdlGraphicsPipelineCreateInfo.PrimitiveType = (Refresh.PrimitiveType) graphicsPipelineCreateInfo.PrimitiveType; | ||||||
| 
 | 
 | ||||||
| 			sdlGraphicsPipelineCreateInfo.RasterizerState = graphicsPipelineCreateInfo.RasterizerState.ToSDL(); | 			sdlGraphicsPipelineCreateInfo.RasterizerState = graphicsPipelineCreateInfo.RasterizerState.ToRefresh(); | ||||||
| 			sdlGraphicsPipelineCreateInfo.MultisampleState = graphicsPipelineCreateInfo.MultisampleState.ToSDL(); | 			sdlGraphicsPipelineCreateInfo.MultisampleState = graphicsPipelineCreateInfo.MultisampleState.ToRefresh(); | ||||||
| 			sdlGraphicsPipelineCreateInfo.DepthStencilState = graphicsPipelineCreateInfo.DepthStencilState.ToSDL(); | 			sdlGraphicsPipelineCreateInfo.DepthStencilState = graphicsPipelineCreateInfo.DepthStencilState.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentCount = (uint) graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length; | 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentCount = (uint) graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length; | ||||||
| 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions = colorAttachmentDescriptions; | 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions = colorAttachmentDescriptions; | ||||||
| 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat = (SDL_Gpu.TextureFormat) graphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat; | 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat = (Refresh.TextureFormat) graphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat; | ||||||
| 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment = Conversions.BoolToInt(graphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment); | 			sdlGraphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment = Conversions.BoolToInt(graphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment); | ||||||
| 
 | 
 | ||||||
| 			sdlGraphicsPipelineCreateInfo.VertexResourceInfo = graphicsPipelineCreateInfo.VertexShaderResourceInfo.ToSDL(); | 			sdlGraphicsPipelineCreateInfo.VertexResourceInfo = graphicsPipelineCreateInfo.VertexShaderResourceInfo.ToRefresh(); | ||||||
| 			sdlGraphicsPipelineCreateInfo.FragmentResourceInfo = graphicsPipelineCreateInfo.FragmentShaderResourceInfo.ToSDL(); | 			sdlGraphicsPipelineCreateInfo.FragmentResourceInfo = graphicsPipelineCreateInfo.FragmentShaderResourceInfo.ToRefresh(); | ||||||
| 
 | 
 | ||||||
| 			sdlGraphicsPipelineCreateInfo.BlendConstants[0] = graphicsPipelineCreateInfo.BlendConstants.R; | 			sdlGraphicsPipelineCreateInfo.BlendConstants[0] = graphicsPipelineCreateInfo.BlendConstants.R; | ||||||
| 			sdlGraphicsPipelineCreateInfo.BlendConstants[1] = graphicsPipelineCreateInfo.BlendConstants.G; | 			sdlGraphicsPipelineCreateInfo.BlendConstants[1] = graphicsPipelineCreateInfo.BlendConstants.G; | ||||||
| 			sdlGraphicsPipelineCreateInfo.BlendConstants[2] = graphicsPipelineCreateInfo.BlendConstants.B; | 			sdlGraphicsPipelineCreateInfo.BlendConstants[2] = graphicsPipelineCreateInfo.BlendConstants.B; | ||||||
| 			sdlGraphicsPipelineCreateInfo.BlendConstants[3] = graphicsPipelineCreateInfo.BlendConstants.A; | 			sdlGraphicsPipelineCreateInfo.BlendConstants[3] = graphicsPipelineCreateInfo.BlendConstants.A; | ||||||
| 
 | 
 | ||||||
| 			Handle = SDL_Gpu.SDL_GpuCreateGraphicsPipeline(device.Handle, sdlGraphicsPipelineCreateInfo); | 			Handle = Refresh.Refresh_CreateGraphicsPipeline(device.Handle, sdlGraphicsPipelineCreateInfo); | ||||||
| 			if (Handle == IntPtr.Zero) | 			if (Handle == IntPtr.Zero) | ||||||
| 			{ | 			{ | ||||||
| 				throw new Exception("Could not create graphics pipeline!"); | 				throw new Exception("Could not create graphics pipeline!"); | ||||||
|  |  | ||||||
|  | @ -1,23 +1,23 @@ | ||||||
| using System; | using System; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
| /// <summary> | /// <summary> | ||||||
| /// A sampler specifies how a texture will be sampled in a shader. | /// A sampler specifies how a texture will be sampled in a shader. | ||||||
| /// </summary> | /// </summary> | ||||||
| public class Sampler : SDL_GpuResource | public class Sampler : RefreshResource | ||||||
| { | { | ||||||
| 	protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseSampler; | 	protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseSampler; | ||||||
| 
 | 
 | ||||||
| 	public Sampler( | 	public Sampler( | ||||||
| 		GraphicsDevice device, | 		GraphicsDevice device, | ||||||
| 		in SamplerCreateInfo samplerCreateInfo | 		in SamplerCreateInfo samplerCreateInfo | ||||||
| 	) : base(device) | 	) : base(device) | ||||||
| 	{ | 	{ | ||||||
| 		Handle = SDL_Gpu.SDL_GpuCreateSampler( | 		Handle = Refresh.Refresh_CreateSampler( | ||||||
| 			device.Handle, | 			device.Handle, | ||||||
| 			samplerCreateInfo.ToSDL() | 			samplerCreateInfo.ToRefresh() | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| using System; | using System; | ||||||
| using System.IO; | using System.IO; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
|  | @ -8,9 +8,9 @@ namespace MoonWorks.Graphics | ||||||
| 	/// <summary> | 	/// <summary> | ||||||
| 	/// Shader modules expect input in Refresh bytecode format. | 	/// Shader modules expect input in Refresh bytecode format. | ||||||
| 	/// </summary> | 	/// </summary> | ||||||
| 	public class Shader : SDL_GpuResource | 	public class Shader : RefreshResource | ||||||
| 	{ | 	{ | ||||||
| 		protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseShader; | 		protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseShader; | ||||||
| 
 | 
 | ||||||
| 		public unsafe Shader( | 		public unsafe Shader( | ||||||
| 			GraphicsDevice device, | 			GraphicsDevice device, | ||||||
|  | @ -46,14 +46,14 @@ namespace MoonWorks.Graphics | ||||||
| 			var bytecodeSpan = new Span<byte>(bytecodeBuffer, (int) stream.Length); | 			var bytecodeSpan = new Span<byte>(bytecodeBuffer, (int) stream.Length); | ||||||
| 			stream.ReadExactly(bytecodeSpan); | 			stream.ReadExactly(bytecodeSpan); | ||||||
| 
 | 
 | ||||||
| 			SDL_Gpu.ShaderCreateInfo shaderCreateInfo; | 			Refresh.ShaderCreateInfo shaderCreateInfo; | ||||||
| 			shaderCreateInfo.CodeSize = (nuint) stream.Length; | 			shaderCreateInfo.CodeSize = (nuint) stream.Length; | ||||||
| 			shaderCreateInfo.Code = (byte*) bytecodeBuffer; | 			shaderCreateInfo.Code = (byte*) bytecodeBuffer; | ||||||
| 			shaderCreateInfo.EntryPointName = entryPointName; | 			shaderCreateInfo.EntryPointName = entryPointName; | ||||||
| 			shaderCreateInfo.Stage = (SDL_Gpu.ShaderStage) shaderStage; | 			shaderCreateInfo.Stage = (Refresh.ShaderStage) shaderStage; | ||||||
| 			shaderCreateInfo.Format = (SDL_Gpu.ShaderFormat) shaderFormat; | 			shaderCreateInfo.Format = (Refresh.ShaderFormat) shaderFormat; | ||||||
| 
 | 
 | ||||||
| 			var shaderModule = SDL_Gpu.SDL_GpuCreateShader( | 			var shaderModule = Refresh.Refresh_CreateShader( | ||||||
| 				device.Handle, | 				device.Handle, | ||||||
| 				shaderCreateInfo | 				shaderCreateInfo | ||||||
| 			); | 			); | ||||||
|  |  | ||||||
|  | @ -1,13 +1,12 @@ | ||||||
| using System; | using System; | ||||||
| using System.IO; | using RefreshCS; | ||||||
| using SDL2_gpuCS; |  | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
| 	/// <summary> | 	/// <summary> | ||||||
| 	/// A container for pixel data. | 	/// A container for pixel data. | ||||||
| 	/// </summary> | 	/// </summary> | ||||||
| 	public class Texture : SDL_GpuResource | 	public class Texture : RefreshResource | ||||||
| 	{ | 	{ | ||||||
| 		public uint Width { get; internal set; } | 		public uint Width { get; internal set; } | ||||||
| 		public uint Height { get; internal set; } | 		public uint Height { get; internal set; } | ||||||
|  | @ -29,7 +28,7 @@ namespace MoonWorks.Graphics | ||||||
| 			{ | 			{ | ||||||
| 				if (Device.DebugMode) | 				if (Device.DebugMode) | ||||||
| 				{ | 				{ | ||||||
| 					SDL_Gpu.SDL_GpuSetTextureName( | 					Refresh.Refresh_SetTextureName( | ||||||
| 						Device.Handle, | 						Device.Handle, | ||||||
| 						Handle, | 						Handle, | ||||||
| 						value | 						value | ||||||
|  | @ -41,7 +40,7 @@ namespace MoonWorks.Graphics | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// FIXME: this allocates a delegate instance | 		// FIXME: this allocates a delegate instance | ||||||
| 		protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseTexture; | 		protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseTexture; | ||||||
| 
 | 
 | ||||||
| 		/// <summary> | 		/// <summary> | ||||||
| 		/// Creates a 2D texture. | 		/// Creates a 2D texture. | ||||||
|  | @ -179,9 +178,9 @@ namespace MoonWorks.Graphics | ||||||
| 			in TextureCreateInfo textureCreateInfo | 			in TextureCreateInfo textureCreateInfo | ||||||
| 		) : base(device) | 		) : base(device) | ||||||
| 		{ | 		{ | ||||||
| 			Handle = SDL_Gpu.SDL_GpuCreateTexture( | 			Handle = Refresh.Refresh_CreateTexture( | ||||||
| 				device.Handle, | 				device.Handle, | ||||||
| 				textureCreateInfo.ToSDL() | 				textureCreateInfo.ToRefresh() | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			Format = textureCreateInfo.Format; | 			Format = textureCreateInfo.Format; | ||||||
|  |  | ||||||
|  | @ -1,12 +1,12 @@ | ||||||
| using System; | using System; | ||||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
| 	public unsafe class TransferBuffer : SDL_GpuResource | 	public unsafe class TransferBuffer : RefreshResource | ||||||
| 	{ | 	{ | ||||||
| 		protected override Action<IntPtr, IntPtr> ReleaseFunction => SDL_Gpu.SDL_GpuReleaseTransferBuffer; | 		protected override Action<IntPtr, IntPtr> ReleaseFunction => Refresh.Refresh_ReleaseTransferBuffer; | ||||||
| 
 | 
 | ||||||
| 		/// <summary> | 		/// <summary> | ||||||
| 		/// Size in bytes. | 		/// Size in bytes. | ||||||
|  | @ -48,10 +48,10 @@ namespace MoonWorks.Graphics | ||||||
| 			uint sizeInBytes | 			uint sizeInBytes | ||||||
| 		) : base(device) | 		) : base(device) | ||||||
| 		{ | 		{ | ||||||
| 			Handle = SDL_Gpu.SDL_GpuCreateTransferBuffer( | 			Handle = Refresh.Refresh_CreateTransferBuffer( | ||||||
| 				device.Handle, | 				device.Handle, | ||||||
| 				(SDL_Gpu.TransferUsage) usage, | 				(Refresh.TransferUsage) usage, | ||||||
| 				(SDL_Gpu.TransferBufferMapFlags) mapFlags, | 				(Refresh.TransferBufferMapFlags) mapFlags, | ||||||
| 				sizeInBytes | 				sizeInBytes | ||||||
| 			); | 			); | ||||||
| 			Size = sizeInBytes; | 			Size = sizeInBytes; | ||||||
|  | @ -82,11 +82,11 @@ namespace MoonWorks.Graphics | ||||||
| 
 | 
 | ||||||
| 			fixed (T* dataPtr = data) | 			fixed (T* dataPtr = data) | ||||||
| 			{ | 			{ | ||||||
| 				SDL_Gpu.SDL_GpuSetTransferData( | 				Refresh.Refresh_SetTransferData( | ||||||
| 					Device.Handle, | 					Device.Handle, | ||||||
| 					(nint) dataPtr, | 					(nint) dataPtr, | ||||||
| 					Handle, | 					Handle, | ||||||
| 					new SDL_Gpu.BufferCopy | 					new Refresh.BufferCopy | ||||||
| 					{ | 					{ | ||||||
| 						SourceOffset = 0, | 						SourceOffset = 0, | ||||||
| 						DestinationOffset = bufferOffsetInBytes, | 						DestinationOffset = bufferOffsetInBytes, | ||||||
|  | @ -134,11 +134,11 @@ namespace MoonWorks.Graphics | ||||||
| 
 | 
 | ||||||
| 			fixed (T* dataPtr = data) | 			fixed (T* dataPtr = data) | ||||||
| 			{ | 			{ | ||||||
| 				SDL_Gpu.SDL_GpuGetTransferData( | 				Refresh.Refresh_GetTransferData( | ||||||
| 					Device.Handle, | 					Device.Handle, | ||||||
| 					Handle, | 					Handle, | ||||||
| 					(nint) dataPtr, | 					(nint) dataPtr, | ||||||
| 					new SDL_Gpu.BufferCopy | 					new Refresh.BufferCopy | ||||||
| 					{ | 					{ | ||||||
| 						SourceOffset = bufferOffsetInBytes, | 						SourceOffset = bufferOffsetInBytes, | ||||||
| 						DestinationOffset = 0, | 						DestinationOffset = 0, | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -106,18 +106,18 @@ namespace MoonWorks.Graphics | ||||||
| 			ColorWriteMask = ColorComponentFlags.None | 			ColorWriteMask = ColorComponentFlags.None | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		public SDL_Gpu.ColorAttachmentBlendState ToSDL() | 		public Refresh.ColorAttachmentBlendState ToRefresh() | ||||||
| 		{ | 		{ | ||||||
| 			return new SDL_Gpu.ColorAttachmentBlendState | 			return new Refresh.ColorAttachmentBlendState | ||||||
| 			{ | 			{ | ||||||
| 				BlendEnable = Conversions.BoolToInt(BlendEnable), | 				BlendEnable = Conversions.BoolToInt(BlendEnable), | ||||||
| 				AlphaBlendOp = (SDL_Gpu.BlendOp) AlphaBlendOp, | 				AlphaBlendOp = (Refresh.BlendOp) AlphaBlendOp, | ||||||
| 				ColorBlendOp = (SDL_Gpu.BlendOp) ColorBlendOp, | 				ColorBlendOp = (Refresh.BlendOp) ColorBlendOp, | ||||||
| 				ColorWriteMask = (SDL_Gpu.ColorComponentFlags) ColorWriteMask, | 				ColorWriteMask = (Refresh.ColorComponentFlags) ColorWriteMask, | ||||||
| 				DestinationAlphaBlendFactor = (SDL_Gpu.BlendFactor) DestinationAlphaBlendFactor, | 				DestinationAlphaBlendFactor = (Refresh.BlendFactor) DestinationAlphaBlendFactor, | ||||||
| 				DestinationColorBlendFactor = (SDL_Gpu.BlendFactor) DestinationColorBlendFactor, | 				DestinationColorBlendFactor = (Refresh.BlendFactor) DestinationColorBlendFactor, | ||||||
| 				SourceAlphaBlendFactor = (SDL_Gpu.BlendFactor) SourceAlphaBlendFactor, | 				SourceAlphaBlendFactor = (Refresh.BlendFactor) SourceAlphaBlendFactor, | ||||||
| 				SourceColorBlendFactor = (SDL_Gpu.BlendFactor) SourceColorBlendFactor | 				SourceColorBlendFactor = (Refresh.BlendFactor) SourceColorBlendFactor | ||||||
| 			}; | 			}; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -93,17 +93,17 @@ namespace MoonWorks.Graphics | ||||||
| 			StencilTestEnable = false | 			StencilTestEnable = false | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		public SDL_Gpu.DepthStencilState ToSDL() | 		public Refresh.DepthStencilState ToRefresh() | ||||||
| 		{ | 		{ | ||||||
| 			return new SDL_Gpu.DepthStencilState | 			return new Refresh.DepthStencilState | ||||||
| 			{ | 			{ | ||||||
| 				DepthTestEnable = Conversions.BoolToInt(DepthTestEnable), | 				DepthTestEnable = Conversions.BoolToInt(DepthTestEnable), | ||||||
| 				BackStencilState = BackStencilState.ToSDL(), | 				BackStencilState = BackStencilState.ToRefresh(), | ||||||
| 				FrontStencilState = FrontStencilState.ToSDL(), | 				FrontStencilState = FrontStencilState.ToRefresh(), | ||||||
| 				CompareMask = CompareMask, | 				CompareMask = CompareMask, | ||||||
| 				WriteMask = WriteMask, | 				WriteMask = WriteMask, | ||||||
| 				Reference = Reference, | 				Reference = Reference, | ||||||
| 				CompareOp = (SDL_Gpu.CompareOp) CompareOp, | 				CompareOp = (Refresh.CompareOp) CompareOp, | ||||||
| 				DepthBoundsTestEnable = Conversions.BoolToInt(DepthBoundsTestEnable), | 				DepthBoundsTestEnable = Conversions.BoolToInt(DepthBoundsTestEnable), | ||||||
| 				DepthWriteEnable = Conversions.BoolToInt(DepthWriteEnable), | 				DepthWriteEnable = Conversions.BoolToInt(DepthWriteEnable), | ||||||
| 				MinDepthBounds = MinDepthBounds, | 				MinDepthBounds = MinDepthBounds, | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -24,11 +24,11 @@ namespace MoonWorks.Graphics | ||||||
| 			SampleMask = sampleMask; | 			SampleMask = sampleMask; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public SDL_Gpu.MultisampleState ToSDL() | 		public Refresh.MultisampleState ToRefresh() | ||||||
| 		{ | 		{ | ||||||
| 			return new SDL_Gpu.MultisampleState | 			return new Refresh.MultisampleState | ||||||
| 			{ | 			{ | ||||||
| 				MultisampleCount = (SDL_Gpu.SampleCount) MultisampleCount, | 				MultisampleCount = (Refresh.SampleCount) MultisampleCount, | ||||||
| 				SampleMask = SampleMask | 				SampleMask = SampleMask | ||||||
| 			}; | 			}; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
|  | @ -106,17 +106,17 @@ public struct RasterizerState | ||||||
| 		DepthBiasEnable = false | 		DepthBiasEnable = false | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.RasterizerState ToSDL() | 	public Refresh.RasterizerState ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.RasterizerState | 		return new Refresh.RasterizerState | ||||||
| 		{ | 		{ | ||||||
| 			CullMode = (SDL_Gpu.CullMode) CullMode, | 			CullMode = (Refresh.CullMode) CullMode, | ||||||
| 			DepthBiasClamp = DepthBiasClamp, | 			DepthBiasClamp = DepthBiasClamp, | ||||||
| 			DepthBiasConstantFactor = DepthBiasConstantFactor, | 			DepthBiasConstantFactor = DepthBiasConstantFactor, | ||||||
| 			DepthBiasEnable = Conversions.BoolToInt(DepthBiasEnable), | 			DepthBiasEnable = Conversions.BoolToInt(DepthBiasEnable), | ||||||
| 			DepthBiasSlopeFactor = DepthBiasSlopeFactor, | 			DepthBiasSlopeFactor = DepthBiasSlopeFactor, | ||||||
| 			FillMode = (SDL_Gpu.FillMode) FillMode, | 			FillMode = (Refresh.FillMode) FillMode, | ||||||
| 			FrontFace = (SDL_Gpu.FrontFace) FrontFace | 			FrontFace = (Refresh.FrontFace) FrontFace | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
|  | @ -150,24 +150,24 @@ public struct SamplerCreateInfo | ||||||
| 		MaxLod = 1000 | 		MaxLod = 1000 | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.SamplerCreateInfo ToSDL() | 	public Refresh.SamplerCreateInfo ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.SamplerCreateInfo | 		return new Refresh.SamplerCreateInfo | ||||||
| 		{ | 		{ | ||||||
| 			MinFilter = (SDL_Gpu.Filter) MinFilter, | 			MinFilter = (Refresh.Filter) MinFilter, | ||||||
| 			MagFilter = (SDL_Gpu.Filter) MagFilter, | 			MagFilter = (Refresh.Filter) MagFilter, | ||||||
| 			MipmapMode = (SDL_Gpu.SamplerMipmapMode) MipmapMode, | 			MipmapMode = (Refresh.SamplerMipmapMode) MipmapMode, | ||||||
| 			AddressModeU = (SDL_Gpu.SamplerAddressMode) AddressModeU, | 			AddressModeU = (Refresh.SamplerAddressMode) AddressModeU, | ||||||
| 			AddressModeV = (SDL_Gpu.SamplerAddressMode) AddressModeV, | 			AddressModeV = (Refresh.SamplerAddressMode) AddressModeV, | ||||||
| 			AddressModeW = (SDL_Gpu.SamplerAddressMode) AddressModeW, | 			AddressModeW = (Refresh.SamplerAddressMode) AddressModeW, | ||||||
| 			MipLodBias = MipLodBias, | 			MipLodBias = MipLodBias, | ||||||
| 			AnisotropyEnable = Conversions.BoolToByte(AnisotropyEnable), | 			AnisotropyEnable = Conversions.BoolToInt(AnisotropyEnable), | ||||||
| 			MaxAnisotropy = MaxAnisotropy, | 			MaxAnisotropy = MaxAnisotropy, | ||||||
| 			CompareEnable = Conversions.BoolToByte(CompareEnable), | 			CompareEnable = Conversions.BoolToInt(CompareEnable), | ||||||
| 			CompareOp = (SDL_Gpu.CompareOp) CompareOp, | 			CompareOp = (Refresh.CompareOp) CompareOp, | ||||||
| 			MinLod = MinLod, | 			MinLod = MinLod, | ||||||
| 			MaxLod = MaxLod, | 			MaxLod = MaxLod, | ||||||
| 			BorderColor = (SDL_Gpu.BorderColor) BorderColor | 			BorderColor = (Refresh.BorderColor) BorderColor | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -17,9 +17,9 @@ namespace MoonWorks.Graphics | ||||||
| 		public TextureFormat Format; | 		public TextureFormat Format; | ||||||
| 		public TextureUsageFlags UsageFlags; | 		public TextureUsageFlags UsageFlags; | ||||||
| 
 | 
 | ||||||
| 		public SDL_Gpu.TextureCreateInfo ToSDL() | 		public Refresh.TextureCreateInfo ToRefresh() | ||||||
| 		{ | 		{ | ||||||
| 			return new SDL_Gpu.TextureCreateInfo | 			return new Refresh.TextureCreateInfo | ||||||
| 			{ | 			{ | ||||||
| 				Width = Width, | 				Width = Width, | ||||||
| 				Height = Height, | 				Height = Height, | ||||||
|  | @ -27,9 +27,9 @@ namespace MoonWorks.Graphics | ||||||
| 				IsCube = Conversions.BoolToInt(IsCube), | 				IsCube = Conversions.BoolToInt(IsCube), | ||||||
| 				LayerCount = LayerCount, | 				LayerCount = LayerCount, | ||||||
| 				LevelCount = LevelCount, | 				LevelCount = LevelCount, | ||||||
| 				SampleCount = (SDL_Gpu.SampleCount) SampleCount, | 				SampleCount = (Refresh.SampleCount) SampleCount, | ||||||
| 				Format = (SDL_Gpu.TextureFormat) Format, | 				Format = (Refresh.TextureFormat) Format, | ||||||
| 				UsageFlags = (SDL_Gpu.TextureUsageFlags) UsageFlags | 				UsageFlags = (Refresh.TextureUsageFlags) UsageFlags | ||||||
| 			}; | 			}; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| 
 | 
 | ||||||
| namespace MoonWorks.Graphics | namespace MoonWorks.Graphics | ||||||
| { | { | ||||||
|  | @ -29,11 +29,11 @@ namespace MoonWorks.Graphics | ||||||
| 			Depth = texture.Depth; | 			Depth = texture.Depth; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		public SDL_Gpu.TextureRegion ToSDL() | 		public Refresh.TextureRegion ToRefresh() | ||||||
| 		{ | 		{ | ||||||
| 			return new SDL_Gpu.TextureRegion | 			return new Refresh.TextureRegion | ||||||
| 			{ | 			{ | ||||||
| 				TextureSlice = TextureSlice.ToSDL(), | 				TextureSlice = TextureSlice.ToRefresh(), | ||||||
| 				X = X, | 				X = X, | ||||||
| 				Y = Y, | 				Y = Y, | ||||||
| 				Z = Z, | 				Z = Z, | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| using SDL2_gpuCS; | using RefreshCS; | ||||||
| namespace MoonWorks.Graphics; | namespace MoonWorks.Graphics; | ||||||
| 
 | 
 | ||||||
| /// <summary> | /// <summary> | ||||||
|  | @ -19,9 +19,9 @@ public struct TextureSlice | ||||||
| 		Layer = 0; | 		Layer = 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public SDL_Gpu.TextureSlice ToSDL() | 	public Refresh.TextureSlice ToRefresh() | ||||||
| 	{ | 	{ | ||||||
| 		return new SDL_Gpu.TextureSlice | 		return new Refresh.TextureSlice | ||||||
| 		{ | 		{ | ||||||
| 			Texture = Texture.Handle, | 			Texture = Texture.Handle, | ||||||
| 			MipLevel = MipLevel, | 			MipLevel = MipLevel, | ||||||
|  |  | ||||||
|  | @ -242,11 +242,11 @@ namespace MoonWorks.Video | ||||||
| 				if (TransferBuffer == null || TransferBuffer.Size < ySpan.Length + uSpan.Length + vSpan.Length) | 				if (TransferBuffer == null || TransferBuffer.Size < ySpan.Length + uSpan.Length + vSpan.Length) | ||||||
| 				{ | 				{ | ||||||
| 					TransferBuffer?.Dispose(); | 					TransferBuffer?.Dispose(); | ||||||
| 					TransferBuffer = new TransferBuffer(Device, TransferUsage.Texture, (uint) (ySpan.Length + uSpan.Length + vSpan.Length)); | 					TransferBuffer = new TransferBuffer(Device, TransferUsage.Texture, TransferBufferMapFlags.Write, (uint) (ySpan.Length + uSpan.Length + vSpan.Length)); | ||||||
| 				} | 				} | ||||||
| 				TransferBuffer.SetData(ySpan, 0, TransferOptions.Cycle); | 				TransferBuffer.SetData(ySpan, 0, true); | ||||||
| 				TransferBuffer.SetData(uSpan, (uint) ySpan.Length, TransferOptions.Unsafe); | 				TransferBuffer.SetData(uSpan, (uint) ySpan.Length, false); | ||||||
| 				TransferBuffer.SetData(vSpan, (uint) (ySpan.Length + uSpan.Length), TransferOptions.Unsafe); | 				TransferBuffer.SetData(vSpan, (uint) (ySpan.Length + uSpan.Length), false); | ||||||
| 
 | 
 | ||||||
| 				uOffset = (uint) ySpan.Length; | 				uOffset = (uint) ySpan.Length; | ||||||
| 				vOffset = (uint) (ySpan.Length + vSpan.Length); | 				vOffset = (uint) (ySpan.Length + vSpan.Length); | ||||||
|  | @ -257,9 +257,9 @@ namespace MoonWorks.Video | ||||||
| 
 | 
 | ||||||
| 			var commandBuffer = Device.AcquireCommandBuffer(); | 			var commandBuffer = Device.AcquireCommandBuffer(); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.BeginCopyPass(); | 			var copyPass = commandBuffer.BeginCopyPass(); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.UploadToTexture( | 			copyPass.UploadToTexture( | ||||||
| 				TransferBuffer, | 				TransferBuffer, | ||||||
| 				yTexture, | 				yTexture, | ||||||
| 				new BufferImageCopy | 				new BufferImageCopy | ||||||
|  | @ -268,10 +268,10 @@ namespace MoonWorks.Video | ||||||
| 					BufferStride = yStride, | 					BufferStride = yStride, | ||||||
| 					BufferImageHeight = yTexture.Height | 					BufferImageHeight = yTexture.Height | ||||||
| 				}, | 				}, | ||||||
| 				WriteOptions.Cycle | 				true | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.UploadToTexture( | 			copyPass.UploadToTexture( | ||||||
| 				TransferBuffer, | 				TransferBuffer, | ||||||
| 				uTexture, | 				uTexture, | ||||||
| 				new BufferImageCopy{ | 				new BufferImageCopy{ | ||||||
|  | @ -279,10 +279,10 @@ namespace MoonWorks.Video | ||||||
| 					BufferStride = uvStride, | 					BufferStride = uvStride, | ||||||
| 					BufferImageHeight = uTexture.Height | 					BufferImageHeight = uTexture.Height | ||||||
| 				}, | 				}, | ||||||
| 				WriteOptions.Cycle | 				true | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.UploadToTexture( | 			copyPass.UploadToTexture( | ||||||
| 				TransferBuffer, | 				TransferBuffer, | ||||||
| 				vTexture, | 				vTexture, | ||||||
| 				new BufferImageCopy | 				new BufferImageCopy | ||||||
|  | @ -291,25 +291,22 @@ namespace MoonWorks.Video | ||||||
| 					BufferStride = uvStride, | 					BufferStride = uvStride, | ||||||
| 					BufferImageHeight = vTexture.Height | 					BufferImageHeight = vTexture.Height | ||||||
| 				}, | 				}, | ||||||
| 				WriteOptions.Cycle | 				true | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.EndCopyPass(); | 			commandBuffer.EndCopyPass(copyPass); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.BeginRenderPass( | 			var renderPass = commandBuffer.BeginRenderPass( | ||||||
| 				new ColorAttachmentInfo(RenderTexture, WriteOptions.Cycle, Color.Black) | 				new ColorAttachmentInfo(RenderTexture, true, Color.Black) | ||||||
| 			); | 			); | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.BindGraphicsPipeline(Device.VideoPipeline); | 			renderPass.BindGraphicsPipeline(Device.VideoPipeline); | ||||||
| 			commandBuffer.BindFragmentSamplers( | 			renderPass.BindFragmentSamplers(new TextureSamplerBinding(yTexture, LinearSampler), 0); | ||||||
| 				new TextureSamplerBinding(yTexture, LinearSampler), | 			renderPass.BindFragmentSamplers(new TextureSamplerBinding(uTexture, LinearSampler), 1); | ||||||
| 				new TextureSamplerBinding(uTexture, LinearSampler), | 			renderPass.BindFragmentSamplers(new TextureSamplerBinding(vTexture, LinearSampler), 2); | ||||||
| 				new TextureSamplerBinding(vTexture, LinearSampler) | 			renderPass.DrawPrimitives(0, 1); | ||||||
| 			); |  | ||||||
| 
 | 
 | ||||||
| 			commandBuffer.DrawPrimitives(0, 1); | 			commandBuffer.EndRenderPass(renderPass); | ||||||
| 
 |  | ||||||
| 			commandBuffer.EndRenderPass(); |  | ||||||
| 
 | 
 | ||||||
| 			Device.Submit(commandBuffer); | 			Device.Submit(commandBuffer); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue