private void TransferGeneric(GpuStateStruct* GpuState)
{
Console.WriteLine("TransferGeneric Not Implemented");
var TextureTransferState = GpuState->TextureTransferState;
var SourceX = TextureTransferState.SourceX;
var SourceY = TextureTransferState.SourceY;
var DestinationX = TextureTransferState.DestinationX;
var DestinationY = TextureTransferState.DestinationY;
var BytesPerPixel = TextureTransferState.BytesPerPixel;
var SourceTotalBytes = TextureTransferState.SourceLineWidth * TextureTransferState.Height * BytesPerPixel;
var DestinationTotalBytes = TextureTransferState.DestinationLineWidth * TextureTransferState.Height * BytesPerPixel;
var SourcePointer = (byte*)Memory.PspAddressToPointerSafe(TextureTransferState.SourceAddress.Address, SourceTotalBytes);
var DestinationPointer = (byte*)Memory.PspAddressToPointerSafe(TextureTransferState.DestinationAddress.Address, DestinationTotalBytes);
for (uint y = 0; y < TextureTransferState.Height; y++)
{
var RowSourceOffset = (uint)(
(TextureTransferState.SourceLineWidth * (y + SourceY)) + SourceX
);
var RowDestinationOffset = (uint)(
(TextureTransferState.DestinationLineWidth * (y + DestinationY)) + DestinationX
);
PointerUtils.Memcpy(
DestinationPointer + RowDestinationOffset * BytesPerPixel,
SourcePointer + RowSourceOffset * BytesPerPixel,
TextureTransferState.Width * BytesPerPixel
);
}
/*
// Generic implementation.
with (gpu.state.textureTransfer) {
auto srcAddressHost = cast(ubyte*)gpu.memory.getPointer(srcAddress);
auto dstAddressHost = cast(ubyte*)gpu.memory.getPointer(dstAddress);
if (gpu.state.drawBuffer.isAnyAddressInBuffer([srcAddress, dstAddress])) {
gpu.performBufferOp(BufferOperation.STORE, BufferType.COLOR);
}
for (int n = 0; n < height; n++) {
int srcOffset = ((n + srcY) * srcLineWidth + srcX) * bpp;
int dstOffset = ((n + dstY) * dstLineWidth + dstX) * bpp;
(dstAddressHost + dstOffset)[0.. width * bpp] = (srcAddressHost + srcOffset)[0.. width * bpp];
//writefln("%08X <- %08X :: [%d]", dstOffset, srcOffset, width * bpp);
}
//std.file.write("buffer", dstAddressHost[0..512 * 272 * 4]);
if (gpu.state.drawBuffer.isAnyAddressInBuffer([dstAddress])) {
//gpu.impl.test();
//gpu.impl.test("trxkick");
gpu.markBufferOp(BufferOperation.LOAD, BufferType.COLOR);
}
//gpu.impl.test();
}
*/
}