update render pass ABI

main
cosmonaut 2022-02-24 22:07:35 -08:00
parent 86f568fe52
commit f7be55f6c6
6 changed files with 86 additions and 170 deletions

View File

@ -1,13 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetName>MoonWorksMultiWindow</TargetName> <TargetName>MoonWorksMultiWindow</TargetName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute> <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>

@ -1 +1 @@
Subproject commit 4acc2588e17f2ad1f594e95e9e06d4d2ae7009ac Subproject commit e5213da686fd4700d16a0c627d5f1ab4fce0ee12

View File

@ -1,36 +0,0 @@
using MoonWorks.Graphics;
namespace MoonWorksMultiWindow.Graphics
{
public class Framebuffers
{
public Framebuffer ExampleFramebuffer { get; }
public Framebuffer ExtraWindowFramebuffer { get; }
public Framebuffers(
GraphicsDevice graphicsDevice,
RenderPasses renderPasses,
RenderTargets renderTargets,
uint renderDimensionsX,
uint renderDimensionsY
) {
ExampleFramebuffer = new Framebuffer(
graphicsDevice,
renderDimensionsX,
renderDimensionsY,
renderPasses.ExampleRenderPass,
null,
renderTargets.ExampleRenderTarget
);
ExtraWindowFramebuffer = new Framebuffer(
graphicsDevice,
renderDimensionsX,
renderDimensionsY,
renderPasses.ExtraWindowRenderPass,
null,
renderTargets.ExtraWindowRenderTarget
);
}
}
}

View File

@ -1,31 +0,0 @@
using MoonWorks.Graphics;
namespace MoonWorksMultiWindow.Graphics
{
public class RenderPasses
{
public RenderPass ExampleRenderPass { get; }
public RenderPass ExtraWindowRenderPass { get; }
public RenderPasses(GraphicsDevice graphicsDevice)
{
var clearPassDescription = new ColorTargetDescription
{
Format = TextureFormat.R8G8B8A8,
LoadOp = LoadOp.Clear,
StoreOp = StoreOp.Store,
MultisampleCount = SampleCount.One
};
ExampleRenderPass = new RenderPass(
graphicsDevice,
clearPassDescription
);
ExtraWindowRenderPass = new RenderPass(
graphicsDevice,
clearPassDescription
);
}
}
}

View File

@ -5,27 +5,18 @@ namespace MoonWorksMultiWindow.Graphics
public class GraphicsObjects public class GraphicsObjects
{ {
public RenderTargets RenderTargets { get; } public RenderTargets RenderTargets { get; }
public Framebuffers Framebuffers { get; }
public RenderPasses RenderPasses { get; }
public GraphicsObjects( public GraphicsObjects(
GraphicsDevice graphicsDevice, GraphicsDevice graphicsDevice,
uint renderDimensionsX, uint renderDimensionsX,
uint renderDimensionsY uint renderDimensionsY
) { )
RenderPasses = new RenderPasses(graphicsDevice); {
RenderTargets = new RenderTargets( RenderTargets = new RenderTargets(
graphicsDevice, graphicsDevice,
renderDimensionsX, renderDimensionsX,
renderDimensionsY renderDimensionsY
); );
Framebuffers = new Framebuffers(
graphicsDevice,
RenderPasses,
RenderTargets,
renderDimensionsX,
renderDimensionsY
);
} }
} }
} }

View File

@ -53,24 +53,20 @@ namespace MoonWorksMultiWindow
mainDraw.Wait(); mainDraw.Wait();
extraDraw.Wait(); extraDraw.Wait();
GraphicsDevice.Submit(mainDraw.Result, extraDraw.Result);
} }
private CommandBuffer MainDraw() private void MainDraw()
{ {
var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); var commandBuffer = GraphicsDevice.AcquireCommandBuffer();
commandBuffer.BeginRenderPass( commandBuffer.BeginRenderPass(
GraphicsObjects.RenderPasses.ExampleRenderPass, new ColorAttachmentInfo
GraphicsObjects.Framebuffers.ExampleFramebuffer,
new Rect
{ {
X = 0, renderTarget = GraphicsObjects.RenderTargets.ExampleRenderTarget,
Y = 0, clearColor = Color.CornflowerBlue,
W = RenderWidth, loadOp = LoadOp.Clear,
H = RenderHeight storeOp = StoreOp.DontCare
}, }
Color.CornflowerBlue.ToVector4()
); );
commandBuffer.EndRenderPass(); commandBuffer.EndRenderPass();
@ -81,24 +77,21 @@ namespace MoonWorksMultiWindow
Window Window
); );
return commandBuffer; GraphicsDevice.Submit(commandBuffer);
} }
private CommandBuffer ExtraWindowDraw() private void ExtraWindowDraw()
{ {
var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); var commandBuffer = GraphicsDevice.AcquireCommandBuffer();
commandBuffer.BeginRenderPass( commandBuffer.BeginRenderPass(
GraphicsObjects.RenderPasses.ExtraWindowRenderPass, new ColorAttachmentInfo
GraphicsObjects.Framebuffers.ExtraWindowFramebuffer,
new Rect
{ {
X = 0, renderTarget = GraphicsObjects.RenderTargets.ExtraWindowRenderTarget,
Y = 0, clearColor = Color.OrangeRed,
W = RenderWidth, loadOp = LoadOp.Clear,
H = RenderHeight storeOp = StoreOp.DontCare
}, }
Color.OrangeRed.ToVector4()
); );
commandBuffer.EndRenderPass(); commandBuffer.EndRenderPass();
@ -109,7 +102,12 @@ namespace MoonWorksMultiWindow
ExtraWindow ExtraWindow
); );
return commandBuffer; GraphicsDevice.Submit(commandBuffer);
}
protected override void OnDestroy()
{
} }
} }
} }