renaming some SDL references

refresh2
cosmonaut 2024-06-05 12:37:02 -07:00
parent baf51d2ee9
commit 35684df005
6 changed files with 96 additions and 97 deletions

View File

@ -122,12 +122,12 @@ public class CommandBuffer
AssertColorTarget(colorAttachmentInfo);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
sdlColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
refreshColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
1,
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
);
@ -170,13 +170,13 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
2,
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
);
@ -226,14 +226,14 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
3,
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
);
@ -289,15 +289,15 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoFour.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
sdlColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
refreshColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
4,
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
);
@ -333,13 +333,13 @@ public class CommandBuffer
AssertValidDepthAttachment(depthStencilAttachmentInfo);
#endif
var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
(Refresh.ColorAttachmentInfo*) nint.Zero,
0,
&sdlDepthStencilAttachmentInfo
&refreshDepthStencilAttachmentInfo
);
var renderPass = Device.RenderPassPool.Obtain();
@ -375,16 +375,16 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfo.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
sdlColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
refreshColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
1,
&sdlDepthStencilAttachmentInfo
&refreshDepthStencilAttachmentInfo
);
var renderPass = Device.RenderPassPool.Obtain();
@ -430,17 +430,17 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
2,
&sdlDepthStencilAttachmentInfo
&refreshDepthStencilAttachmentInfo
);
var renderPass = Device.RenderPassPool.Obtain();
@ -493,18 +493,18 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
3,
&sdlDepthStencilAttachmentInfo
&refreshDepthStencilAttachmentInfo
);
var renderPass = Device.RenderPassPool.Obtain();
@ -564,19 +564,19 @@ public class CommandBuffer
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
#endif
var sdlColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
sdlColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
sdlColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
sdlColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
sdlColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
refreshColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
var sdlDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
Handle,
sdlColorAttachmentInfos,
refreshColorAttachmentInfos,
4,
&sdlDepthStencilAttachmentInfo
&refreshDepthStencilAttachmentInfo
);
var renderPass = Device.RenderPassPool.Obtain();
@ -650,11 +650,11 @@ public class CommandBuffer
computePassActive = true;
#endif
var sdlTextureBinding = readWriteTextureBinding.ToRefresh();
var refreshTextureBinding = readWriteTextureBinding.ToRefresh();
var computePassHandle = Refresh.Refresh_BeginComputePass(
Handle,
&sdlTextureBinding,
&refreshTextureBinding,
1,
(Refresh.StorageBufferReadWriteBinding*) nint.Size,
0
@ -679,13 +679,13 @@ public class CommandBuffer
computePassActive = true;
#endif
var sdlBufferBinding = readWriteBufferBinding.ToRefresh();
var refreshBufferBinding = readWriteBufferBinding.ToRefresh();
var computePassHandle = Refresh.Refresh_BeginComputePass(
Handle,
(Refresh.StorageTextureReadWriteBinding*) nint.Zero,
0,
&sdlBufferBinding,
&refreshBufferBinding,
1
);
@ -709,14 +709,14 @@ public class CommandBuffer
computePassActive = true;
#endif
var sdlTextureBinding = readWriteTextureBinding.ToRefresh();
var sdlBufferBinding = readWriteBufferBinding.ToRefresh();
var refreshTextureBinding = readWriteTextureBinding.ToRefresh();
var refreshBufferBinding = readWriteBufferBinding.ToRefresh();
var computePassHandle = Refresh.Refresh_BeginComputePass(
Handle,
&sdlTextureBinding,
&refreshTextureBinding,
1,
&sdlBufferBinding,
&refreshBufferBinding,
1
);
@ -740,19 +740,19 @@ public class CommandBuffer
computePassActive = true;
#endif
var sdlTextureBindings = NativeMemory.Alloc(
var refreshTextureBindings = NativeMemory.Alloc(
(nuint) (readWriteTextureBindings.Length * Marshal.SizeOf<StorageTextureReadWriteBinding>())
);
var sdlBufferBindings = NativeMemory.Alloc(
var refreshBufferBindings = NativeMemory.Alloc(
(nuint) (readWriteBufferBindings.Length * Marshal.SizeOf<StorageBufferReadWriteBinding>())
);
var computePassHandle = Refresh.Refresh_BeginComputePass(
Handle,
(Refresh.StorageTextureReadWriteBinding*) sdlTextureBindings,
(Refresh.StorageTextureReadWriteBinding*) refreshTextureBindings,
(uint) readWriteTextureBindings.Length,
(Refresh.StorageBufferReadWriteBinding*) sdlBufferBindings,
(Refresh.StorageBufferReadWriteBinding*) refreshBufferBindings,
(uint) readWriteBufferBindings.Length
);
@ -763,8 +763,8 @@ public class CommandBuffer
computePass.active = true;
#endif
NativeMemory.Free(sdlTextureBindings);
NativeMemory.Free(sdlBufferBindings);
NativeMemory.Free(refreshTextureBindings);
NativeMemory.Free(refreshBufferBindings);
return computePass;
}

View File

@ -56,12 +56,12 @@ public class ComputePass
AssertTextureHasComputeStorageReadFlag(textureSlice.Texture);
#endif
var sdlTextureSlice = textureSlice.ToRefresh();
var refreshTextureSlice = textureSlice.ToRefresh();
Refresh.Refresh_BindComputeStorageTextures(
Handle,
slot,
&sdlTextureSlice,
&refreshTextureSlice,
1
);
}

View File

@ -2,7 +2,6 @@ using System;
using System.IO;
using System.Runtime.InteropServices;
using RefreshCS;
using SDL2;
namespace MoonWorks.Graphics
{

View File

@ -117,12 +117,12 @@ public class RenderPass
AssertGraphicsPipelineBound();
#endif
var sdlBufferBinding = bufferBinding.ToRefresh();
var refreshBufferBinding = bufferBinding.ToRefresh();
Refresh.Refresh_BindVertexBuffers(
Handle,
firstBinding,
&sdlBufferBinding,
&refreshBufferBinding,
1
);
}
@ -163,12 +163,12 @@ public class RenderPass
AssertTextureHasSamplerFlag(textureSamplerBinding.Texture);
#endif
var sdlTextureSamplerBinding = textureSamplerBinding.ToRefresh();
var refreshTextureSamplerBinding = textureSamplerBinding.ToRefresh();
Refresh.Refresh_BindVertexSamplers(
Handle,
slot,
&sdlTextureSamplerBinding,
&refreshTextureSamplerBinding,
1
);
}
@ -183,12 +183,12 @@ public class RenderPass
AssertTextureHasGraphicsStorageFlag(textureSlice.Texture);
#endif
var sdlTextureSlice = textureSlice.ToRefresh();
var refreshTextureSlice = textureSlice.ToRefresh();
Refresh.Refresh_BindVertexStorageTextures(
Handle,
slot,
&sdlTextureSlice,
&refreshTextureSlice,
1
);
}
@ -223,12 +223,12 @@ public class RenderPass
AssertTextureHasSamplerFlag(textureSamplerBinding.Texture);
#endif
var sdlTextureSamplerBinding = textureSamplerBinding.ToRefresh();
var refreshTextureSamplerBinding = textureSamplerBinding.ToRefresh();
Refresh.Refresh_BindFragmentSamplers(
Handle,
slot,
&sdlTextureSamplerBinding,
&refreshTextureSamplerBinding,
1
);
}
@ -243,12 +243,12 @@ public class RenderPass
AssertTextureHasGraphicsStorageFlag(textureSlice.Texture);
#endif
var sdlTextureSlice = textureSlice.ToRefresh();
var refreshTextureSlice = textureSlice.ToRefresh();
Refresh.Refresh_BindFragmentStorageTextures(
Handle,
slot,
&sdlTextureSlice,
&refreshTextureSlice,
1
);
}

View File

@ -18,7 +18,7 @@ namespace MoonWorks.Graphics
ComputePipelineResourceInfo resourceInfo
) : base(device)
{
var sdlComputePipelineCreateInfo = new Refresh.ComputePipelineCreateInfo
var refreshComputePipelineCreateInfo = new Refresh.ComputePipelineCreateInfo
{
ComputeShader = computeShader.Handle,
PipelineResourceInfo = resourceInfo.ToRefresh()
@ -26,7 +26,7 @@ namespace MoonWorks.Graphics
Handle = Refresh.Refresh_CreateComputePipeline(
device.Handle,
sdlComputePipelineCreateInfo
refreshComputePipelineCreateInfo
);
if (Handle == IntPtr.Zero)

View File

@ -25,7 +25,7 @@ namespace MoonWorks.Graphics
in GraphicsPipelineCreateInfo graphicsPipelineCreateInfo
) : base(device)
{
Refresh.GraphicsPipelineCreateInfo sdlGraphicsPipelineCreateInfo;
Refresh.GraphicsPipelineCreateInfo refreshGraphicsPipelineCreateInfo;
var vertexAttributes = (Refresh.VertexAttribute*) NativeMemory.Alloc(
(nuint) (graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length * Marshal.SizeOf<Refresh.VertexAttribute>())
@ -55,34 +55,34 @@ namespace MoonWorks.Graphics
colorAttachmentDescriptions[i].BlendState = graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions[i].BlendState.ToRefresh();
}
sdlGraphicsPipelineCreateInfo.VertexShader = graphicsPipelineCreateInfo.VertexShader.Handle;
sdlGraphicsPipelineCreateInfo.FragmentShader = graphicsPipelineCreateInfo.FragmentShader.Handle;
refreshGraphicsPipelineCreateInfo.VertexShader = graphicsPipelineCreateInfo.VertexShader.Handle;
refreshGraphicsPipelineCreateInfo.FragmentShader = graphicsPipelineCreateInfo.FragmentShader.Handle;
sdlGraphicsPipelineCreateInfo.VertexInputState.VertexAttributes = vertexAttributes;
sdlGraphicsPipelineCreateInfo.VertexInputState.VertexAttributeCount = (uint) graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length;
sdlGraphicsPipelineCreateInfo.VertexInputState.VertexBindings = vertexBindings;
sdlGraphicsPipelineCreateInfo.VertexInputState.VertexBindingCount = (uint) graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length;
refreshGraphicsPipelineCreateInfo.VertexInputState.VertexAttributes = vertexAttributes;
refreshGraphicsPipelineCreateInfo.VertexInputState.VertexAttributeCount = (uint) graphicsPipelineCreateInfo.VertexInputState.VertexAttributes.Length;
refreshGraphicsPipelineCreateInfo.VertexInputState.VertexBindings = vertexBindings;
refreshGraphicsPipelineCreateInfo.VertexInputState.VertexBindingCount = (uint) graphicsPipelineCreateInfo.VertexInputState.VertexBindings.Length;
sdlGraphicsPipelineCreateInfo.PrimitiveType = (Refresh.PrimitiveType) graphicsPipelineCreateInfo.PrimitiveType;
refreshGraphicsPipelineCreateInfo.PrimitiveType = (Refresh.PrimitiveType) graphicsPipelineCreateInfo.PrimitiveType;
sdlGraphicsPipelineCreateInfo.RasterizerState = graphicsPipelineCreateInfo.RasterizerState.ToRefresh();
sdlGraphicsPipelineCreateInfo.MultisampleState = graphicsPipelineCreateInfo.MultisampleState.ToRefresh();
sdlGraphicsPipelineCreateInfo.DepthStencilState = graphicsPipelineCreateInfo.DepthStencilState.ToRefresh();
refreshGraphicsPipelineCreateInfo.RasterizerState = graphicsPipelineCreateInfo.RasterizerState.ToRefresh();
refreshGraphicsPipelineCreateInfo.MultisampleState = graphicsPipelineCreateInfo.MultisampleState.ToRefresh();
refreshGraphicsPipelineCreateInfo.DepthStencilState = graphicsPipelineCreateInfo.DepthStencilState.ToRefresh();
sdlGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentCount = (uint) graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length;
sdlGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions = colorAttachmentDescriptions;
sdlGraphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat = (Refresh.TextureFormat) graphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat;
sdlGraphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment = Conversions.BoolToInt(graphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment);
refreshGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentCount = (uint) graphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions.Length;
refreshGraphicsPipelineCreateInfo.AttachmentInfo.ColorAttachmentDescriptions = colorAttachmentDescriptions;
refreshGraphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat = (Refresh.TextureFormat) graphicsPipelineCreateInfo.AttachmentInfo.DepthStencilFormat;
refreshGraphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment = Conversions.BoolToInt(graphicsPipelineCreateInfo.AttachmentInfo.HasDepthStencilAttachment);
sdlGraphicsPipelineCreateInfo.VertexResourceInfo = graphicsPipelineCreateInfo.VertexShaderResourceInfo.ToRefresh();
sdlGraphicsPipelineCreateInfo.FragmentResourceInfo = graphicsPipelineCreateInfo.FragmentShaderResourceInfo.ToRefresh();
refreshGraphicsPipelineCreateInfo.VertexResourceInfo = graphicsPipelineCreateInfo.VertexShaderResourceInfo.ToRefresh();
refreshGraphicsPipelineCreateInfo.FragmentResourceInfo = graphicsPipelineCreateInfo.FragmentShaderResourceInfo.ToRefresh();
sdlGraphicsPipelineCreateInfo.BlendConstants[0] = graphicsPipelineCreateInfo.BlendConstants.R;
sdlGraphicsPipelineCreateInfo.BlendConstants[1] = graphicsPipelineCreateInfo.BlendConstants.G;
sdlGraphicsPipelineCreateInfo.BlendConstants[2] = graphicsPipelineCreateInfo.BlendConstants.B;
sdlGraphicsPipelineCreateInfo.BlendConstants[3] = graphicsPipelineCreateInfo.BlendConstants.A;
refreshGraphicsPipelineCreateInfo.BlendConstants[0] = graphicsPipelineCreateInfo.BlendConstants.R;
refreshGraphicsPipelineCreateInfo.BlendConstants[1] = graphicsPipelineCreateInfo.BlendConstants.G;
refreshGraphicsPipelineCreateInfo.BlendConstants[2] = graphicsPipelineCreateInfo.BlendConstants.B;
refreshGraphicsPipelineCreateInfo.BlendConstants[3] = graphicsPipelineCreateInfo.BlendConstants.A;
Handle = Refresh.Refresh_CreateGraphicsPipeline(device.Handle, sdlGraphicsPipelineCreateInfo);
Handle = Refresh.Refresh_CreateGraphicsPipeline(device.Handle, refreshGraphicsPipelineCreateInfo);
if (Handle == IntPtr.Zero)
{
throw new Exception("Could not create graphics pipeline!");