Fix initializing resource texture manager before assigning to effect
このコミットが含まれているのは:
1 親
9e0eeeedca
コミット
45bdc6d426
2ファイル変更
+27
-5
検索条件に一致するファイルはありません
+18
-3
@@ -153,15 +153,17 @@ partial struct ResourceTextureManager
|
||||
|
||||
Buffer.MemoryCopy(data, @this->data, dataSize, dataSize);
|
||||
|
||||
@this->dataSize = dataSize;
|
||||
|
||||
if (strides is not null)
|
||||
{
|
||||
@this->strides = (uint*)NativeMemory.Alloc(sizeof(uint) * resourceTextureProperties->dimensions);
|
||||
@this->strides = (uint*)NativeMemory.Alloc(sizeof(uint) * (resourceTextureProperties->dimensions - 1));
|
||||
|
||||
Buffer.MemoryCopy(
|
||||
source: strides,
|
||||
destination: @this->strides,
|
||||
destinationSizeInBytes: sizeof(uint) * resourceTextureProperties->dimensions,
|
||||
sourceBytesToCopy: sizeof(uint) * resourceTextureProperties->dimensions);
|
||||
destinationSizeInBytes: sizeof(uint) * (resourceTextureProperties->dimensions - 1),
|
||||
sourceBytesToCopy: sizeof(uint) * (resourceTextureProperties->dimensions - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -182,6 +184,19 @@ partial struct ResourceTextureManager
|
||||
byte* data,
|
||||
uint dataCount)
|
||||
{
|
||||
if (minimumExtents is null ||
|
||||
maximumExtents is null ||
|
||||
data is null)
|
||||
{
|
||||
return E.E_POINTER;
|
||||
}
|
||||
|
||||
if (@this->d2D1ResourceTexture is null &&
|
||||
@this->data is null)
|
||||
{
|
||||
return E.E_NOT_VALID_STATE;
|
||||
}
|
||||
|
||||
// If a resource texture already exists, just forward the call
|
||||
if (@this->d2D1ResourceTexture is not null)
|
||||
{
|
||||
|
||||
+9
-2
@@ -147,16 +147,23 @@ partial struct ResourceTextureManager
|
||||
dataSize: @this->dataSize,
|
||||
resourceTexture: resourceTexture);
|
||||
|
||||
// If creation was successful, release the buffered data
|
||||
// If creation was successful, release the buffered data. Going forwards,
|
||||
// the resource texture will be used directly for all updates requested.
|
||||
if (result == S.S_OK)
|
||||
{
|
||||
NativeMemory.Free(@this->resourceTextureProperties.extents);
|
||||
NativeMemory.Free(@this->resourceTextureProperties.extendModes);
|
||||
NativeMemory.Free(@this->data);
|
||||
NativeMemory.Free(@this->strides);
|
||||
|
||||
// Reset the stored pointers to avoid double frees from Release()
|
||||
@this->resourceTextureProperties.extents = null;
|
||||
@this->resourceTextureProperties.extendModes = null;
|
||||
@this->data = null;
|
||||
@this->strides = null;
|
||||
}
|
||||
|
||||
return S.S_OK;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする