diff --git a/MoonWorks.csproj b/MoonWorks.csproj index 589de8b..658c8a9 100644 --- a/MoonWorks.csproj +++ b/MoonWorks.csproj @@ -25,20 +25,17 @@ - - MoonWorks.Graphics.StockShaders.Fullscreen.vert.refresh + + MoonWorks.Graphics.StockShaders.Fullscreen.vert.spv - - MoonWorks.Graphics.StockShaders.VideoYUV2RGBA.frag.refresh + + MoonWorks.Graphics.StockShaders.VideoYUV2RGBA.frag.spv - - MoonWorks.Graphics.StockShaders.TextTransform.vert.refresh + + MoonWorks.Graphics.StockShaders.TextTransform.vert.spv - - MoonWorks.Graphics.StockShaders.TextMSDF.frag.refresh - - - MoonWorks.Graphics.StockShaders.Blit.frag.refresh + + MoonWorks.Graphics.StockShaders.TextMSDF.frag.spv diff --git a/src/Graphics/GraphicsDevice.cs b/src/Graphics/GraphicsDevice.cs index 0c6e538..ec4add3 100644 --- a/src/Graphics/GraphicsDevice.cs +++ b/src/Graphics/GraphicsDevice.cs @@ -67,7 +67,6 @@ namespace MoonWorks.Graphics string textFragPath = Path.Combine(basePath, "text_msdf.frag.refresh"); string videoFragPath = Path.Combine(basePath, "video_yuv2rgba.frag.refresh"); - string blitFragPath = Path.Combine(basePath, "blit.frag.refresh"); Shader fullscreenVertShader; @@ -75,7 +74,6 @@ namespace MoonWorks.Graphics Shader textFragShader; Shader videoFragShader; - Shader blitFragShader; if (File.Exists(fullscreenVertPath)) { @@ -91,7 +89,7 @@ namespace MoonWorks.Graphics { // use defaults var assembly = typeof(GraphicsDevice).Assembly; - using var vertStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.Fullscreen.vert.refresh"); + using var vertStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.Fullscreen.vert.spv"); fullscreenVertShader = new Shader( this, vertStream, @@ -115,7 +113,7 @@ namespace MoonWorks.Graphics { // use defaults var assembly = typeof(GraphicsDevice).Assembly; - using var fragStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.VideoYUV2RGBA.frag.refresh"); + using var fragStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.VideoYUV2RGBA.frag.spv"); videoFragShader = new Shader( this, fragStream, @@ -148,8 +146,8 @@ namespace MoonWorks.Graphics // use defaults var assembly = typeof(GraphicsDevice).Assembly; - using var vertStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.TextTransform.vert.refresh"); - using var fragStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.TextMSDF.frag.refresh"); + using var vertStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.TextTransform.vert.spv"); + using var fragStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.TextMSDF.frag.spv"); textVertShader = new Shader( this, @@ -168,31 +166,6 @@ namespace MoonWorks.Graphics ); } - if (File.Exists(blitFragPath)) - { - blitFragShader = new Shader( - this, - blitFragPath, - "main", - ShaderStage.Fragment, - ShaderFormat.SECRET - ); - } - else - { - // use defaults - var assembly = typeof(GraphicsDevice).Assembly; - - using var fragStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.Blit.frag.refresh"); - blitFragShader = new Shader( - this, - fragStream, - "main", - ShaderStage.Fragment, - ShaderFormat.SPIRV - ); - } - VideoPipeline = new GraphicsPipeline( this, new GraphicsPipelineCreateInfo diff --git a/src/Graphics/StockShaders/Binary/blit.frag.refresh b/src/Graphics/StockShaders/Binary/blit.frag.refresh deleted file mode 100644 index 5ca4059..0000000 Binary files a/src/Graphics/StockShaders/Binary/blit.frag.refresh and /dev/null differ diff --git a/src/Graphics/StockShaders/Binary/fullscreen.vert.refresh b/src/Graphics/StockShaders/Binary/fullscreen.vert.refresh deleted file mode 100644 index 750264a..0000000 Binary files a/src/Graphics/StockShaders/Binary/fullscreen.vert.refresh and /dev/null differ diff --git a/src/Graphics/StockShaders/Binary/fullscreen.vert.spv b/src/Graphics/StockShaders/Binary/fullscreen.vert.spv new file mode 100644 index 0000000..59eae92 Binary files /dev/null and b/src/Graphics/StockShaders/Binary/fullscreen.vert.spv differ diff --git a/src/Graphics/StockShaders/Binary/text_msdf.frag.refresh b/src/Graphics/StockShaders/Binary/text_msdf.frag.spv similarity index 53% rename from src/Graphics/StockShaders/Binary/text_msdf.frag.refresh rename to src/Graphics/StockShaders/Binary/text_msdf.frag.spv index c28ff6c..91aef3b 100644 Binary files a/src/Graphics/StockShaders/Binary/text_msdf.frag.refresh and b/src/Graphics/StockShaders/Binary/text_msdf.frag.spv differ diff --git a/src/Graphics/StockShaders/Binary/text_transform.vert.refresh b/src/Graphics/StockShaders/Binary/text_transform.vert.refresh deleted file mode 100644 index 12c3a3e..0000000 Binary files a/src/Graphics/StockShaders/Binary/text_transform.vert.refresh and /dev/null differ diff --git a/src/Graphics/StockShaders/Binary/text_transform.vert.spv b/src/Graphics/StockShaders/Binary/text_transform.vert.spv new file mode 100644 index 0000000..6e1063d Binary files /dev/null and b/src/Graphics/StockShaders/Binary/text_transform.vert.spv differ diff --git a/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.refresh b/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.refresh deleted file mode 100644 index bde60ba..0000000 Binary files a/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.refresh and /dev/null differ diff --git a/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.spv b/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.spv new file mode 100644 index 0000000..68346e2 Binary files /dev/null and b/src/Graphics/StockShaders/Binary/video_yuv2rgba.frag.spv differ diff --git a/src/Graphics/StockShaders/Source/blit.frag b/src/Graphics/StockShaders/Source/blit.frag deleted file mode 100644 index de32fd1..0000000 --- a/src/Graphics/StockShaders/Source/blit.frag +++ /dev/null @@ -1,12 +0,0 @@ -#version 450 - -layout (location = 0) in vec2 TexCoord; - -layout (location = 0) out vec4 FragColor; - -layout (binding = 0, set = 1) uniform sampler2D TexSampler; - -void main() -{ - FragColor = texture(TexSampler, TexCoord); -} diff --git a/src/Graphics/StockShaders/Source/text_msdf.frag b/src/Graphics/StockShaders/Source/text_msdf.frag index 046682e..e3a5f55 100644 --- a/src/Graphics/StockShaders/Source/text_msdf.frag +++ b/src/Graphics/StockShaders/Source/text_msdf.frag @@ -1,13 +1,13 @@ #version 450 -layout(set = 1, binding = 0) uniform sampler2D msdf; - layout(location = 0) in vec2 inTexCoord; layout(location = 1) in vec4 inColor; layout(location = 0) out vec4 outColor; -layout(binding = 0, set = 3) uniform UBO +layout(set = 2, binding = 0) uniform sampler2D msdf; + +layout(set = 3, binding = 0) uniform UBO { float pxRange; } ubo; diff --git a/src/Graphics/StockShaders/Source/text_transform.vert b/src/Graphics/StockShaders/Source/text_transform.vert index f64037c..42f7827 100644 --- a/src/Graphics/StockShaders/Source/text_transform.vert +++ b/src/Graphics/StockShaders/Source/text_transform.vert @@ -7,7 +7,7 @@ layout(location = 2) in vec4 inColor; layout(location = 0) out vec2 outTexCoord; layout(location = 1) out vec4 outColor; -layout(binding = 0, set = 2) uniform UBO +layout(set = 1, binding = 0) uniform UBO { mat4 ViewProjection; } ubo; diff --git a/src/Graphics/StockShaders/Source/video_yuv2rgba.frag b/src/Graphics/StockShaders/Source/video_yuv2rgba.frag index fe2b5a1..d0d5510 100644 --- a/src/Graphics/StockShaders/Source/video_yuv2rgba.frag +++ b/src/Graphics/StockShaders/Source/video_yuv2rgba.frag @@ -9,9 +9,9 @@ layout(location = 0) in vec2 TexCoord; layout(location = 0) out vec4 FragColor; -layout(binding = 0, set = 1) uniform sampler2D YSampler; -layout(binding = 1, set = 1) uniform sampler2D USampler; -layout(binding = 2, set = 1) uniform sampler2D VSampler; +layout(set = 2, binding = 0) uniform sampler2D YSampler; +layout(set = 2, binding = 1) uniform sampler2D USampler; +layout(set = 2, binding = 2) uniform sampler2D VSampler; /* More info about colorspace conversion: * http://www.equasys.de/colorconversion.html diff --git a/src/Window.cs b/src/Window.cs index 74d270e..e0c1ff3 100644 --- a/src/Window.cs +++ b/src/Window.cs @@ -31,6 +31,8 @@ namespace MoonWorks } } + public string Title { get; private set;} + private bool IsDisposed; private static Dictionary idLookup = new Dictionary(); @@ -111,7 +113,7 @@ namespace MoonWorks /// /// /// - public void SetWindowSize(uint width, uint height) + public void SetSize(uint width, uint height) { SDL.SDL_SetWindowSize(Handle, (int) width, (int) height); Width = width; @@ -131,6 +133,15 @@ namespace MoonWorks SDL.SDL_SetWindowPosition(Handle, x, y); } + /// + /// Sets the window title. + /// + public void SetTitle(string title) + { + SDL.SDL_SetWindowTitle(Handle, title); + Title = title; + } + internal static Window Lookup(uint windowID) { return idLookup.ContainsKey(windowID) ? idLookup[windowID] : null;