Minor code tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-15 15:01:18 +02:00
1 親 ced3fdc78b
コミット f41dd507c8
4ファイル変更
+53 -38

検索条件に一致するファイルはありません

+4 -4
ファイルの表示
@@ -135,14 +135,14 @@ public static unsafe class D2D1ResourceTextureManager
/// </summary>
/// <param name="resourceTextureManager">A pointer to the <c>ID2D1ResourceTextureManager</c> instance to use.</param>
/// <param name="minimumExtents">The "left" extent of the updates if specified (if empty, the entire texture is updated).</param>
/// <param name="maximumExtents">The "right" extent of the updates if specified (if empty, the entire texture is updated).</param>
/// <param name="maximimumExtents">The "right" extent of the updates if specified (if empty, the entire texture is updated).</param>
/// <param name="strides">The stride to advance through the input data, according to dimension.</param>
/// <param name="dimensions">The number of dimensions in the resource texture. This must match the number used to load the texture.</param>
/// <param name="data">The data to be placed into the resource texture.</param>
public static void Update(
void* resourceTextureManager,
ReadOnlySpan<uint> minimumExtents,
ReadOnlySpan<uint> maximumExtents,
ReadOnlySpan<uint> maximimumExtents,
ReadOnlySpan<uint> strides,
uint dimensions,
ReadOnlySpan<byte> data)
@@ -150,13 +150,13 @@ public static unsafe class D2D1ResourceTextureManager
// TODO: validate argument and return
fixed (uint* pMinimumExtents = minimumExtents)
fixed (uint* pMaximumExtents = maximumExtents)
fixed (uint* pMaximumExtents = maximimumExtents)
fixed (uint* pStrides = strides)
fixed (byte* pData = data)
{
int hresult = ((ID2D1ResourceTextureManager*)resourceTextureManager)->Update(
minimumExtents: pMinimumExtents,
maximumExtents: pMaximumExtents,
maximimumExtents: pMaximumExtents,
strides: pStrides,
dimensions: dimensions,
data: pData,
@@ -61,21 +61,20 @@ internal unsafe struct ID2D1ResourceTextureManager
uint* strides,
uint dataSize)
{
return
((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManager*, Guid*, D2D1_RESOURCE_TEXTURE_PROPERTIES*, byte*, uint*, uint, int>)this.lpVtbl[3])(
(ID2D1ResourceTextureManager*)Unsafe.AsPointer(ref this),
resourceId,
resourceTextureProperties,
data,
strides,
dataSize);
return ((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManager*, Guid*, D2D1_RESOURCE_TEXTURE_PROPERTIES*, byte*, uint*, uint, int>)this.lpVtbl[3])(
(ID2D1ResourceTextureManager*)Unsafe.AsPointer(ref this),
resourceId,
resourceTextureProperties,
data,
strides,
dataSize);
}
/// <summary>
/// Updates the specific resource texture inside the specific range or box using the supplied data.
/// </summary>
/// <param name="minimumExtents">The "left" extent of the updates if specified. If <see langword="null"/>, the entire texture is updated.</param>
/// <param name="maximumExtents">The "right" extent of the updates if specified. If <see langword="null"/>, the entire texture is updated.</param>
/// <param name="maximimumExtents">The "right" extent of the updates if specified. If <see langword="null"/>, the entire texture is updated.</param>
/// <param name="strides">The stride to advance through the input data, according to dimension.</param>
/// <param name="dimensions">The number of dimensions in the resource texture. This must match the number used to load the texture.</param>
/// <param name="data">The data to be placed into the resource texture.</param>
@@ -84,20 +83,19 @@ internal unsafe struct ID2D1ResourceTextureManager
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Update(
uint* minimumExtents,
uint* maximumExtents,
uint* maximimumExtents,
uint* strides,
uint dimensions,
byte* data,
uint dataCount)
{
return
((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManager*, uint*, uint*, uint*, uint, byte*, uint, int>)this.lpVtbl[4])(
(ID2D1ResourceTextureManager*)Unsafe.AsPointer(ref this),
minimumExtents,
maximumExtents,
strides,
dimensions,
data,
dataCount);
return ((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManager*, uint*, uint*, uint*, uint, byte*, uint, int>)this.lpVtbl[4])(
(ID2D1ResourceTextureManager*)Unsafe.AsPointer(ref this),
minimumExtents,
maximimumExtents,
strides,
dimensions,
data,
dataCount);
}
}
@@ -51,10 +51,9 @@ internal unsafe struct ID2D1ResourceTextureManagerInternal
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int SetEffectContext(ID2D1EffectContext* effectContext)
{
return
((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManagerInternal*, ID2D1EffectContext*, int>)this.lpVtbl[3])(
(ID2D1ResourceTextureManagerInternal*)Unsafe.AsPointer(ref this),
effectContext);
return ((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManagerInternal*, ID2D1EffectContext*, int>)this.lpVtbl[3])(
(ID2D1ResourceTextureManagerInternal*)Unsafe.AsPointer(ref this),
effectContext);
}
/// <summary>
@@ -65,9 +64,8 @@ internal unsafe struct ID2D1ResourceTextureManagerInternal
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetResourceTexture(ID2D1ResourceTexture** resourceTexture)
{
return
((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManagerInternal*, ID2D1ResourceTexture**, int>)this.lpVtbl[4])(
(ID2D1ResourceTextureManagerInternal*)Unsafe.AsPointer(ref this),
resourceTexture);
return ((delegate* unmanaged[Stdcall]<ID2D1ResourceTextureManagerInternal*, ID2D1ResourceTexture**, int>)this.lpVtbl[4])(
(ID2D1ResourceTextureManagerInternal*)Unsafe.AsPointer(ref this),
resourceTexture);
}
}
@@ -32,7 +32,7 @@ partial struct ResourceTextureManager
public delegate int UpdateDelegate(
ResourceTextureManager* @this,
uint* minimumExtents,
uint* maximumExtents,
uint* maximimumExtents,
uint* strides,
uint dimensions,
byte* data,
@@ -141,14 +141,14 @@ partial struct ResourceTextureManager
public static int Update(
ResourceTextureManager* @this,
uint* minimumExtents,
uint* maximumExtents,
uint* maximimumExtents,
uint* strides,
uint dimensions,
byte* data,
uint dataCount)
{
if (minimumExtents is null ||
maximumExtents is null ||
maximimumExtents is null ||
data is null)
{
return E.E_POINTER;
@@ -167,16 +167,22 @@ partial struct ResourceTextureManager
{
return @this->d2D1ResourceTexture->Update(
minimumExtents: minimumExtents,
maximimumExtents: maximumExtents,
maximimumExtents: maximimumExtents,
strides: strides,
dimensions: dimensions,
data: data,
dataCount: dataCount);
}
// TODO: implement Update over buffered data
return 0;
// Otherwise update the staging buffer
return UpdateWithStagingBuffer(
@this: @this,
minimumExtents: minimumExtents,
maximimumExtents: maximimumExtents,
strides: strides,
dimensions: dimensions,
data: data,
dataCount: dataCount);
}
}
@@ -286,5 +292,18 @@ partial struct ResourceTextureManager
return S.S_OK;
}
/// <inheritdoc cref="ID2D1ResourceTextureManager.Update"/>
private static int UpdateWithStagingBuffer(
ResourceTextureManager* @this,
uint* minimumExtents,
uint* maximimumExtents,
uint* strides,
uint dimensions,
byte* data,
uint dataCount)
{
return E.E_NOTIMPL;
}
}
}