mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
bugfix
This commit is contained in:
+17
-20
@@ -74,32 +74,29 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
if (type == PaintElementType.View)
|
if (type == PaintElementType.View)
|
||||||
{
|
{
|
||||||
using (var device = _texture.Device)
|
var context = _texture.Device.ImmediateContext;
|
||||||
using (var context = device.ImmediateContext)
|
var dataBox = context.MapSubresource(_texture, 0, MapMode.WriteDiscard, MapFlags.None);
|
||||||
|
if (dataBox.IsEmpty == false)
|
||||||
{
|
{
|
||||||
var dataBox = context.MapSubresource(_texture, 0, MapMode.WriteDiscard, MapFlags.None);
|
var sourcePtr = buffer;
|
||||||
if (dataBox.IsEmpty == false)
|
var destinationPtr = dataBox.DataPointer;
|
||||||
|
var rowPitch = dataBox.RowPitch;
|
||||||
|
var pitch = width * 4;
|
||||||
|
if (rowPitch == pitch)
|
||||||
{
|
{
|
||||||
var sourcePtr = buffer;
|
WinApi.CopyMemory(destinationPtr, sourcePtr, (uint)(width * height * 4));
|
||||||
var destinationPtr = dataBox.DataPointer;
|
}
|
||||||
var rowPitch = dataBox.RowPitch;
|
else
|
||||||
var pitch = width * 4;
|
{
|
||||||
if (rowPitch == pitch)
|
for (var i = height; i > 0; --i)
|
||||||
{
|
{
|
||||||
WinApi.CopyMemory(destinationPtr, sourcePtr, (uint)(width * height * 4));
|
WinApi.CopyMemory(destinationPtr, sourcePtr, (uint)pitch);
|
||||||
}
|
sourcePtr += pitch;
|
||||||
else
|
destinationPtr += rowPitch;
|
||||||
{
|
|
||||||
for (var i = height; i > 0; --i)
|
|
||||||
{
|
|
||||||
WinApi.CopyMemory(destinationPtr, sourcePtr, (uint)pitch);
|
|
||||||
sourcePtr += pitch;
|
|
||||||
destinationPtr += rowPitch;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.UnmapSubresource(_texture, 0);
|
|
||||||
}
|
}
|
||||||
|
context.UnmapSubresource(_texture, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ namespace VRCX
|
|||||||
// 메모리 릭 때문에 미리 생성해놓고 계속 사용함
|
// 메모리 릭 때문에 미리 생성해놓고 계속 사용함
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
m_Device = new Device(DriverType.Hardware, DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.BgraSupport);
|
m_Device = new Device(
|
||||||
|
DriverType.Hardware,
|
||||||
|
DeviceCreationFlags.BgraSupport
|
||||||
|
);
|
||||||
m_Texture1 = new Texture2D(m_Device, new Texture2DDescription()
|
m_Texture1 = new Texture2D(m_Device, new Texture2DDescription()
|
||||||
{
|
{
|
||||||
Width = 512,
|
Width = 512,
|
||||||
|
|||||||
Reference in New Issue
Block a user