Revert "render flag"

This reverts commit ed681f4d08.
This commit is contained in:
pypy
2021-03-08 21:12:21 +09:00
parent 291169fce0
commit 260ea0a541

View File

@@ -20,7 +20,6 @@ namespace VRCX
private GCHandle _paintBuffer;
private int _width;
private int _height;
private bool _dirty;
public OffScreenBrowser(string address, int width, int height)
: base(
@@ -62,57 +61,53 @@ namespace VRCX
public void RenderToTexture(Texture2D texture)
{
if (_dirty == true)
_paintBufferLock.EnterReadLock();
try
{
_dirty = false;
_paintBufferLock.EnterReadLock();
try
if (_width > 0 &&
_height > 0)
{
if (_width > 0 &&
_height > 0)
var context = texture.Device.ImmediateContext;
var dataBox = context.MapSubresource(
texture,
0,
MapMode.WriteDiscard,
MapFlags.None
);
if (dataBox.IsEmpty == false)
{
var context = texture.Device.ImmediateContext;
var dataBox = context.MapSubresource(
texture,
0,
MapMode.WriteDiscard,
MapFlags.None
);
if (dataBox.IsEmpty == false)
var sourcePtr = _paintBuffer.AddrOfPinnedObject();
var destinationPtr = dataBox.DataPointer;
var pitch = _width * 4;
var rowPitch = dataBox.RowPitch;
if (pitch == rowPitch)
{
var sourcePtr = _paintBuffer.AddrOfPinnedObject();
var destinationPtr = dataBox.DataPointer;
var pitch = _width * 4;
var rowPitch = dataBox.RowPitch;
if (pitch == rowPitch)
WinApi.CopyMemory(
destinationPtr,
sourcePtr,
(uint)(_width * _height * 4)
);
}
else
{
for (var y = _height; y > 0; --y)
{
WinApi.CopyMemory(
destinationPtr,
sourcePtr,
(uint)(_width * _height * 4)
(uint)pitch
);
}
else
{
for (var y = _height; y > 0; --y)
{
WinApi.CopyMemory(
destinationPtr,
sourcePtr,
(uint)pitch
);
sourcePtr += pitch;
destinationPtr += rowPitch;
}
sourcePtr += pitch;
destinationPtr += rowPitch;
}
}
context.UnmapSubresource(texture, 0);
}
context.UnmapSubresource(texture, 0);
}
finally
{
_paintBufferLock.ExitReadLock();
}
}
finally
{
_paintBufferLock.ExitReadLock();
}
}
@@ -178,7 +173,6 @@ namespace VRCX
{
_paintBufferLock.ExitWriteLock();
}
_dirty = true;
}
}