diff --git a/src/Buffer.cs b/src/Buffer.cs index e48ec19..43f67a5 100644 --- a/src/Buffer.cs +++ b/src/Buffer.cs @@ -8,7 +8,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyBuffer; public Buffer( - RefreshDevice device, + GraphicsDevice device, Refresh.BufferUsageFlags usageFlags, uint sizeInBytes ) : base(device) diff --git a/src/ColorTarget.cs b/src/ColorTarget.cs index 2eb78e7..b93d96c 100644 --- a/src/ColorTarget.cs +++ b/src/ColorTarget.cs @@ -13,7 +13,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyColorTarget; - public ColorTarget(RefreshDevice device, Refresh.SampleCount sampleCount, ref TextureSlice textureSlice) : base(device) + public ColorTarget(GraphicsDevice device, Refresh.SampleCount sampleCount, ref TextureSlice textureSlice) : base(device) { var refreshTextureSlice = textureSlice.ToRefreshTextureSlice(); Handle = Refresh.Refresh_CreateColorTarget(device.Handle, sampleCount, ref refreshTextureSlice); diff --git a/src/CommandBuffer.cs b/src/CommandBuffer.cs index 609a75e..74bf059 100644 --- a/src/CommandBuffer.cs +++ b/src/CommandBuffer.cs @@ -6,11 +6,11 @@ namespace Campari { public struct CommandBuffer { - public RefreshDevice Device { get; } + public GraphicsDevice Device { get; } public IntPtr Handle { get; } // called from RefreshDevice - internal CommandBuffer(RefreshDevice device, IntPtr handle) + internal CommandBuffer(GraphicsDevice device, IntPtr handle) { Device = device; Handle = handle; diff --git a/src/DepthStencilTarget.cs b/src/DepthStencilTarget.cs index 480a0a1..d8e90ed 100644 --- a/src/DepthStencilTarget.cs +++ b/src/DepthStencilTarget.cs @@ -11,7 +11,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyDepthStencilTarget; - public DepthStencilTarget(RefreshDevice device, uint width, uint height, Refresh.DepthFormat depthFormat) : base(device) + public DepthStencilTarget(GraphicsDevice device, uint width, uint height, Refresh.DepthFormat depthFormat) : base(device) { Handle = Refresh.Refresh_CreateDepthStencilTarget(device.Handle, width, height, depthFormat); Width = width; diff --git a/src/Framebuffer.cs b/src/Framebuffer.cs index 562be90..4c86afd 100644 --- a/src/Framebuffer.cs +++ b/src/Framebuffer.cs @@ -8,7 +8,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyFramebuffer; public unsafe Framebuffer( - RefreshDevice device, + GraphicsDevice device, uint width, uint height, RenderPass renderPass, diff --git a/src/RefreshDevice.cs b/src/GraphicsDevice.cs similarity index 83% rename from src/RefreshDevice.cs rename to src/GraphicsDevice.cs index 828aa3c..7720aaa 100644 --- a/src/RefreshDevice.cs +++ b/src/GraphicsDevice.cs @@ -6,16 +6,23 @@ using RefreshCS; namespace Campari { - public class RefreshDevice : IDisposable + public class GraphicsDevice : IDisposable { public IntPtr Handle { get; } public bool IsDisposed { get; private set; } - public RefreshDevice( - Refresh.PresentationParameters presentationParameters, + public GraphicsDevice( + IntPtr deviceWindowHandle, + Refresh.PresentMode presentMode, bool debugMode ) { + var presentationParameters = new Refresh.PresentationParameters + { + deviceWindowHandle = deviceWindowHandle, + presentMode = presentMode + }; + Handle = Refresh.Refresh_CreateDevice( ref presentationParameters, Conversions.BoolToByte(debugMode) @@ -60,7 +67,7 @@ namespace Campari } // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources - ~RefreshDevice() + ~GraphicsDevice() { // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method Dispose(disposing: false); diff --git a/src/GraphicsPipeline.cs b/src/GraphicsPipeline.cs index e0ccee4..bcbd5ba 100644 --- a/src/GraphicsPipeline.cs +++ b/src/GraphicsPipeline.cs @@ -9,7 +9,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyGraphicsPipeline; public unsafe GraphicsPipeline( - RefreshDevice device, + GraphicsDevice device, ColorBlendState colorBlendState, DepthStencilState depthStencilState, ShaderStageState vertexShaderState, diff --git a/src/GraphicsResource.cs b/src/GraphicsResource.cs index 2c77ef5..206269e 100644 --- a/src/GraphicsResource.cs +++ b/src/GraphicsResource.cs @@ -6,13 +6,13 @@ namespace Campari { public abstract class GraphicsResource : IDisposable { - public RefreshDevice Device { get; } + public GraphicsDevice Device { get; } public IntPtr Handle { get; protected set; } public bool IsDisposed { get; private set; } protected abstract Action QueueDestroyFunction { get; } - public GraphicsResource(RefreshDevice device) + public GraphicsResource(GraphicsDevice device) { Device = device; } diff --git a/src/RenderPass.cs b/src/RenderPass.cs index dba6c29..16b4e33 100644 --- a/src/RenderPass.cs +++ b/src/RenderPass.cs @@ -8,7 +8,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyRenderPass; public unsafe RenderPass( - RefreshDevice device, + GraphicsDevice device, params Refresh.ColorTargetDescription[] colorTargetDescriptions ) : base(device) { @@ -24,7 +24,7 @@ namespace Campari } public unsafe RenderPass( - RefreshDevice device, + GraphicsDevice device, Refresh.DepthStencilTargetDescription depthStencilTargetDescription, params Refresh.ColorTargetDescription[] colorTargetDescriptions ) : base(device) diff --git a/src/Sampler.cs b/src/Sampler.cs index 12f6e53..6e27264 100644 --- a/src/Sampler.cs +++ b/src/Sampler.cs @@ -8,7 +8,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroySampler; public Sampler( - RefreshDevice device, + GraphicsDevice device, ref SamplerState samplerState ) : base(device) { diff --git a/src/ShaderModule.cs b/src/ShaderModule.cs index e932857..37e123e 100644 --- a/src/ShaderModule.cs +++ b/src/ShaderModule.cs @@ -8,7 +8,7 @@ namespace Campari { protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyShaderModule; - public unsafe ShaderModule(RefreshDevice device, FileInfo fileInfo) : base(device) + public unsafe ShaderModule(GraphicsDevice device, FileInfo fileInfo) : base(device) { fixed (uint* ptr = Bytecode.ReadBytecode(fileInfo)) { diff --git a/src/Texture.cs b/src/Texture.cs index 62d36cd..5c34033 100644 --- a/src/Texture.cs +++ b/src/Texture.cs @@ -12,7 +12,7 @@ namespace Campari protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyTexture; - public static Texture LoadPNG(RefreshDevice device, FileInfo fileInfo) + public static Texture LoadPNG(GraphicsDevice device, FileInfo fileInfo) { var pixels = Refresh.Refresh_Image_Load( fileInfo.FullName, @@ -40,7 +40,7 @@ namespace Campari } public static Texture CreateTexture2D( - RefreshDevice device, + GraphicsDevice device, uint width, uint height, Refresh.ColorFormat format, @@ -65,7 +65,7 @@ namespace Campari } public static Texture CreateTexture3D( - RefreshDevice device, + GraphicsDevice device, uint width, uint height, uint depth, @@ -91,7 +91,7 @@ namespace Campari } public static Texture CreateTextureCube( - RefreshDevice device, + GraphicsDevice device, uint size, Refresh.ColorFormat format, Refresh.TextureUsageFlags usageFlags, @@ -114,7 +114,7 @@ namespace Campari return new Texture(device, ref textureCreateInfo); } - public Texture(RefreshDevice device, ref Campari.TextureCreateInfo textureCreateInfo) : base(device) + public Texture(GraphicsDevice device, ref Campari.TextureCreateInfo textureCreateInfo) : base(device) { var refreshTextureCreateInfo = textureCreateInfo.ToRefreshTextureCreateInfo();