update tests for MoonWorks API changes

pull/2/head
cosmonaut 2023-04-05 12:41:19 -07:00
parent 129421e80a
commit a2d1fea543
5 changed files with 9 additions and 18 deletions

View File

@ -110,7 +110,7 @@ namespace MoonWorks.Test
GraphicsDevice.Wait(); GraphicsDevice.Wait();
// Print the squares! // Print the squares!
squaresBuffer.GetData(squares, (uint) (sizeof(uint) * squares.Length)); squaresBuffer.GetData(squares);
Logger.LogInfo("Squares of the first " + squares.Length + " integers: " + string.Join(", ", squares)); Logger.LogInfo("Squares of the first " + squares.Length + " integers: " + string.Join(", ", squares));
} }

View File

@ -130,7 +130,7 @@ namespace MoonWorks.Test
// Compare the original bytes to the copied bytes. // Compare the original bytes to the copied bytes.
byte[] copiedBytes = new byte[textureBytes.Length]; byte[] copiedBytes = new byte[textureBytes.Length];
compareBuffer.GetData<byte>(copiedBytes, (uint) copiedBytes.Length); compareBuffer.GetData(copiedBytes);
var originalSpan = new System.ReadOnlySpan<byte>(textureBytes); var originalSpan = new System.ReadOnlySpan<byte>(textureBytes);
var copiedSpan = new System.ReadOnlySpan<byte>(copiedBytes); var copiedSpan = new System.ReadOnlySpan<byte>(copiedBytes);

View File

@ -45,10 +45,7 @@ namespace MoonWorks.Test
// Read back and print out the vertex values // Read back and print out the vertex values
PositionVertex[] readbackVertices = new PositionVertex[vertices.Length]; PositionVertex[] readbackVertices = new PositionVertex[vertices.Length];
vertexBuffer.GetData( vertexBuffer.GetData(readbackVertices);
readbackVertices,
(uint) (vertexSize * readbackVertices.Length) // FIXME: Seems like this should get auto-calculated somehow
);
for (int i = 0; i < readbackVertices.Length; i += 1) for (int i = 0; i < readbackVertices.Length; i += 1)
{ {
Logger.LogInfo(readbackVertices[i].ToString()); Logger.LogInfo(readbackVertices[i].ToString());
@ -61,10 +58,7 @@ namespace MoonWorks.Test
GraphicsDevice.Wait(); GraphicsDevice.Wait();
// Read the updated buffer // Read the updated buffer
vertexBuffer.GetData( vertexBuffer.GetData(readbackVertices);
readbackVertices,
(uint) (vertexSize * readbackVertices.Length)
);
Logger.LogInfo("=== Change first three vertices ==="); Logger.LogInfo("=== Change first three vertices ===");
for (int i = 0; i < readbackVertices.Length; i += 1) for (int i = 0; i < readbackVertices.Length; i += 1)
{ {
@ -84,10 +78,7 @@ namespace MoonWorks.Test
GraphicsDevice.Wait(); GraphicsDevice.Wait();
// Read the updated buffer // Read the updated buffer
vertexBuffer.GetData( vertexBuffer.GetData(readbackVertices);
readbackVertices,
(uint) (vertexSize * readbackVertices.Length)
);
Logger.LogInfo("=== Change last two vertices ==="); Logger.LogInfo("=== Change last two vertices ===");
for (int i = 0; i < readbackVertices.Length; i += 1) for (int i = 0; i < readbackVertices.Length; i += 1)
{ {

View File

@ -80,7 +80,7 @@ namespace MoonWorks.Test
i i
); );
var pixels = Refresh.Refresh_Image_Load( var pixels = Refresh.Refresh_Image_LoadPNGFromFile(
TestUtils.GetTexturePath($"tex3d_{i}.png"), TestUtils.GetTexturePath($"tex3d_{i}.png"),
out var width, out var width,
out var height, out var height,
@ -90,7 +90,7 @@ namespace MoonWorks.Test
var byteCount = (uint) (width * height * channels); var byteCount = (uint) (width * height * channels);
cmdbuf.SetTextureData(slice, pixels, byteCount); cmdbuf.SetTextureData(slice, pixels, byteCount);
Refresh.Refresh_Image_Free(pixels); Refresh.Refresh_Image_FreePNG(pixels);
} }
GraphicsDevice.Submit(cmdbuf); GraphicsDevice.Submit(cmdbuf);

View File

@ -80,7 +80,7 @@ namespace MoonWorks.Test
(uint) i (uint) i
); );
var pixels = Refresh.Refresh_Image_Load( var pixels = Refresh.Refresh_Image_LoadPNGFromFile(
TestUtils.GetTexturePath($"mip{i}.png"), TestUtils.GetTexturePath($"mip{i}.png"),
out var width, out var width,
out var height, out var height,
@ -90,7 +90,7 @@ namespace MoonWorks.Test
var byteCount = (uint)(width * height * channels); var byteCount = (uint)(width * height * channels);
cmdbuf.SetTextureData(slice, pixels, byteCount); cmdbuf.SetTextureData(slice, pixels, byteCount);
Refresh.Refresh_Image_Free(pixels); Refresh.Refresh_Image_FreePNG(pixels);
} }
GraphicsDevice.Submit(cmdbuf); GraphicsDevice.Submit(cmdbuf);