Embed video shaders

pull/52/head
cosmonaut 2023-12-12 18:52:03 -08:00
parent aa9baf2dff
commit 6d1acc37e9
8 changed files with 56 additions and 33 deletions

View File

@ -24,4 +24,13 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory> <CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="src\Graphics\StockShaders\Binary\video_fullscreen.vert.refresh">
<LogicalName>MoonWorks.Graphics.StockShaders.VideoFullscreen.vert.refresh</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="src\Graphics\StockShaders\Binary\video_yuv2rgba.frag.refresh">
<LogicalName>MoonWorks.Graphics.StockShaders.VideoYUV2RGBA.frag.refresh</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

@ -1 +1 @@
Subproject commit 3dcd69ff85db80eea51481edd323b42c05993e1a Subproject commit 5065e2cd4662dbe023b77a45ef967f975170dfff

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using SDL2;
using SDL2;
using MoonWorks.Audio; using MoonWorks.Audio;
using MoonWorks.Graphics; using MoonWorks.Graphics;
using MoonWorks.Input; using MoonWorks.Input;

View File

@ -45,10 +45,26 @@ namespace MoonWorks.Graphics
string basePath = System.AppContext.BaseDirectory; string basePath = System.AppContext.BaseDirectory;
string videoVertPath = Path.Combine(basePath, "video_fullscreen.vert.refresh"); string videoVertPath = Path.Combine(basePath, "video_fullscreen.vert.refresh");
string videoFragPath = Path.Combine(basePath, "video_yuv2rgba.frag.refresh"); string videoFragPath = Path.Combine(basePath, "video_yuv2rgba.frag.refresh");
ShaderModule videoVertShader;
ShaderModule videoFragShader;
if (File.Exists(videoVertPath) && File.Exists(videoFragPath)) if (File.Exists(videoVertPath) && File.Exists(videoFragPath))
{ {
ShaderModule videoVertShader = new ShaderModule(this, videoVertPath); videoVertShader = new ShaderModule(this, videoVertPath);
ShaderModule videoFragShader = new ShaderModule(this, videoFragPath); videoFragShader = new ShaderModule(this, videoFragPath);
}
else
{
// use defaults
var assembly = typeof(GraphicsDevice).Assembly;
using var vertStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.VideoFullscreen.vert.refresh");
using var fragStream = assembly.GetManifestResourceStream("MoonWorks.Graphics.StockShaders.VideoYUV2RGBA.frag.refresh");
videoVertShader = new ShaderModule(this, vertStream);
videoFragShader = new ShaderModule(this, fragStream);
}
VideoPipeline = new GraphicsPipeline( VideoPipeline = new GraphicsPipeline(
this, this,
@ -77,7 +93,6 @@ namespace MoonWorks.Graphics
MultisampleState = MultisampleState.None MultisampleState = MultisampleState.None
} }
); );
}
FencePool = new FencePool(this); FencePool = new FencePool(this);
} }