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">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<TargetName>MoonWorksMultiWindow</TargetName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<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 RenderTargets RenderTargets { get; }
public Framebuffers Framebuffers { get; }
public RenderPasses RenderPasses { get; }
public GraphicsObjects(
GraphicsDevice graphicsDevice,
uint renderDimensionsX,
uint renderDimensionsY
) {
RenderPasses = new RenderPasses(graphicsDevice);
)
{
RenderTargets = new RenderTargets(
graphicsDevice,
renderDimensionsX,
renderDimensionsY
);
Framebuffers = new Framebuffers(
graphicsDevice,
RenderPasses,
RenderTargets,
renderDimensionsX,
renderDimensionsY
);
}
}
}

View File

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