Embed video shaders
parent
3044e9fe86
commit
c28c4a9db0
|
@ -25,4 +25,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
|
|
@ -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;
|
||||||
|
|
|
@ -45,39 +45,54 @@ 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);
|
||||||
|
|
||||||
VideoPipeline = new GraphicsPipeline(
|
|
||||||
this,
|
|
||||||
new GraphicsPipelineCreateInfo
|
|
||||||
{
|
|
||||||
AttachmentInfo = new GraphicsPipelineAttachmentInfo(
|
|
||||||
new ColorAttachmentDescription(
|
|
||||||
TextureFormat.R8G8B8A8,
|
|
||||||
ColorAttachmentBlendState.None
|
|
||||||
)
|
|
||||||
),
|
|
||||||
DepthStencilState = DepthStencilState.Disable,
|
|
||||||
VertexShaderInfo = GraphicsShaderInfo.Create(
|
|
||||||
videoVertShader,
|
|
||||||
"main",
|
|
||||||
0
|
|
||||||
),
|
|
||||||
FragmentShaderInfo = GraphicsShaderInfo.Create(
|
|
||||||
videoFragShader,
|
|
||||||
"main",
|
|
||||||
3
|
|
||||||
),
|
|
||||||
VertexInputState = VertexInputState.Empty,
|
|
||||||
RasterizerState = RasterizerState.CCW_CullNone,
|
|
||||||
PrimitiveType = PrimitiveType.TriangleList,
|
|
||||||
MultisampleState = MultisampleState.None
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
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(
|
||||||
|
this,
|
||||||
|
new GraphicsPipelineCreateInfo
|
||||||
|
{
|
||||||
|
AttachmentInfo = new GraphicsPipelineAttachmentInfo(
|
||||||
|
new ColorAttachmentDescription(
|
||||||
|
TextureFormat.R8G8B8A8,
|
||||||
|
ColorAttachmentBlendState.None
|
||||||
|
)
|
||||||
|
),
|
||||||
|
DepthStencilState = DepthStencilState.Disable,
|
||||||
|
VertexShaderInfo = GraphicsShaderInfo.Create(
|
||||||
|
videoVertShader,
|
||||||
|
"main",
|
||||||
|
0
|
||||||
|
),
|
||||||
|
FragmentShaderInfo = GraphicsShaderInfo.Create(
|
||||||
|
videoFragShader,
|
||||||
|
"main",
|
||||||
|
3
|
||||||
|
),
|
||||||
|
VertexInputState = VertexInputState.Empty,
|
||||||
|
RasterizerState = RasterizerState.CCW_CullNone,
|
||||||
|
PrimitiveType = PrimitiveType.TriangleList,
|
||||||
|
MultisampleState = MultisampleState.None
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
FencePool = new FencePool(this);
|
FencePool = new FencePool(this);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue