daily update on 20240226 by nitload youmu
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Logic;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -12,8 +13,6 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
|
||||
internal unsafe partial class GLonUpdate : IglFunc
|
||||
{
|
||||
private static ConcurrentQueue<IntPtr> glActionQueue;
|
||||
@@ -139,7 +138,7 @@ namespace StgSharp.Graphics
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
GCHandle codePtr = GCHandle.Alloc(Encoding.UTF8.GetBytes(shaderCode[i] + '\0'), GCHandleType.Pinned);
|
||||
paramQueue.Enqueue((IntPtr)shaderHandle.handle + i, codePtr.AddrOfPinnedObject());
|
||||
paramQueue.Enqueue((IntPtr)(shaderHandle.handle + i), codePtr.AddrOfPinnedObject());
|
||||
}
|
||||
glActionQueue.Enqueue(CompileShaderPtr);
|
||||
return shaderHandle;
|
||||
@@ -235,12 +234,15 @@ namespace StgSharp.Graphics
|
||||
case TypeCode.UInt32:
|
||||
a = GLconst.UNSIGNED_INT;
|
||||
break;
|
||||
|
||||
case TypeCode.UInt16:
|
||||
a = GLconst.UNSIGNED_SHORT;
|
||||
break;
|
||||
|
||||
case TypeCode.Byte:
|
||||
a = GLconst.UNSIGNED_BYTE;
|
||||
break;
|
||||
|
||||
default:
|
||||
InternalIO.InternalWriteLog(
|
||||
$"Parameter error in parameter {type} method DrawElements. " +
|
||||
@@ -343,13 +345,12 @@ namespace StgSharp.Graphics
|
||||
//TODO:双线程,换运行环境
|
||||
void IglFunc.SwitchContext()
|
||||
{
|
||||
|
||||
paramQueue.context = api;
|
||||
}
|
||||
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, T[] pixels)
|
||||
unsafe void IglFunc.TextureImage2d<T>(int target, int level, uint internalformat, uint width, uint height, uint format, uint type, glHandle pixels)
|
||||
{
|
||||
IntPtr source = GCHandle.Alloc(pixels, GCHandleType.Pinned).AddrOfPinnedObject();
|
||||
paramQueue.Enqueue(source);
|
||||
paramQueue.Enqueue(pixels);
|
||||
paramQueue.Enqueue((uint)level, internalformat, width, height);
|
||||
paramQueue.Enqueue((uint)target, format, type);
|
||||
glActionQueue.Enqueue(textureImage2dPtr);
|
||||
@@ -388,4 +389,4 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user