some tweaks

refresh2
cosmonaut 2024-06-05 14:19:17 -07:00
parent 35684df005
commit 7386952974
6 changed files with 46 additions and 9 deletions

View File

@ -183,6 +183,41 @@ public class CopyPass
);
}
public void DownloadFromBuffer(
GpuBuffer buffer,
TransferBuffer transferBuffer,
in BufferCopy copyParams
) {
#if DEBUG
AssertBufferBoundsCheck(buffer.Size, copyParams.SrcOffset, copyParams.Size);
AssertBufferBoundsCheck(transferBuffer.Size, copyParams.DstOffset, copyParams.Size);
#endif
Refresh.Refresh_DownloadFromBuffer(
Handle,
buffer.Handle,
transferBuffer.Handle,
copyParams.ToRefresh()
);
}
public void DownloadFromTexture(
in TextureRegion textureRegion,
TransferBuffer transferBuffer,
in BufferImageCopy copyParams
) {
#if DEBUG
AssertBufferBoundsCheck(transferBuffer.Size, copyParams.BufferOffset, textureRegion.Size);
#endif
Refresh.Refresh_DownloadFromTexture(
Handle,
textureRegion.ToRefresh(),
transferBuffer.Handle,
copyParams.ToRefresh()
);
}
#if DEBUG
private void AssertBufferBoundsCheck(uint bufferLengthInBytes, uint offsetInBytes, uint copyLengthInBytes)
{

View File

@ -139,7 +139,7 @@ namespace MoonWorks.Graphics.Font
// Call this AFTER binding your text pipeline!
public void Render(RenderPass renderPass, Math.Float.Matrix4x4 transformMatrix)
{
renderPass.BindFragmentSamplers(new TextureSamplerBinding(
renderPass.BindFragmentSampler(new TextureSamplerBinding(
CurrentFont.Texture,
GraphicsDevice.LinearSampler
));

View File

@ -896,28 +896,28 @@ public readonly record struct TextureSamplerBinding(
public readonly record struct StorageBufferReadWriteBinding(
GpuBuffer Buffer,
bool cycle
bool Cycle
) {
public Refresh.StorageBufferReadWriteBinding ToRefresh()
{
return new Refresh.StorageBufferReadWriteBinding
{
Buffer = Buffer.Handle,
Cycle = Conversions.BoolToInt(cycle)
Cycle = Conversions.BoolToInt(Cycle)
};
}
}
public readonly record struct StorageTextureReadWriteBinding(
in TextureSlice TextureSlice,
bool cycle
bool Cycle
) {
public Refresh.StorageTextureReadWriteBinding ToRefresh()
{
return new Refresh.StorageTextureReadWriteBinding
{
TextureSlice = TextureSlice.ToRefresh(),
Cycle = Conversions.BoolToInt(cycle)
Cycle = Conversions.BoolToInt(Cycle)
};
}
}

View File

@ -213,7 +213,7 @@ public class RenderPass
);
}
public unsafe void BindFragmentSamplers(
public unsafe void BindFragmentSampler(
in TextureSamplerBinding textureSamplerBinding,
uint slot = 0
) {

View File

@ -301,9 +301,9 @@ namespace MoonWorks.Video
);
renderPass.BindGraphicsPipeline(Device.VideoPipeline);
renderPass.BindFragmentSamplers(new TextureSamplerBinding(yTexture, LinearSampler), 0);
renderPass.BindFragmentSamplers(new TextureSamplerBinding(uTexture, LinearSampler), 1);
renderPass.BindFragmentSamplers(new TextureSamplerBinding(vTexture, LinearSampler), 2);
renderPass.BindFragmentSampler(new TextureSamplerBinding(yTexture, LinearSampler), 0);
renderPass.BindFragmentSampler(new TextureSamplerBinding(uTexture, LinearSampler), 1);
renderPass.BindFragmentSampler(new TextureSamplerBinding(vTexture, LinearSampler), 2);
renderPass.DrawPrimitives(0, 1);
commandBuffer.EndRenderPass(renderPass);

View File

@ -43,6 +43,7 @@
uint windowWidth,
uint windowHeight,
ScreenMode screenMode,
Graphics.SwapchainComposition swapchainComposition,
Graphics.PresentMode presentMode,
bool systemResizable = false,
bool startMaximized = false
@ -51,6 +52,7 @@
WindowWidth = windowWidth;
WindowHeight = windowHeight;
ScreenMode = screenMode;
SwapchainComposition = swapchainComposition;
PresentMode = presentMode;
SystemResizable = systemResizable;
StartMaximized = startMaximized;