Fix GPUTexture.DownloadData to use correct bindings api

This commit is contained in:
2026-04-28 00:24:34 +02:00
parent f4905cfccc
commit 8e76d0d9d8
3 changed files with 7 additions and 16 deletions
+1 -1
View File
@@ -535,7 +535,7 @@ public:
/// </summary>
/// <param name="result">The destination texture data container.</param>
/// <returns>True if cannot download data, otherwise false.</returns>
API_FUNCTION() bool DownloadData(TextureData& result);
API_FUNCTION() bool DownloadData(API_PARAM(Out) TextureData& result);
/// <summary>
/// Creates GPU async task that will gather texture data from the GPU.
@@ -5,20 +5,6 @@ using System.Runtime.InteropServices;
namespace FlaxEngine
{
partial class GPUTexture
{
/// <summary>
/// Downloads the texture data to be accessible from CPU. For frequent access, use staging textures, otherwise current thread will be stalled to wait for the GPU frame to copy data into staging buffer.
/// </summary>
/// <returns>Downloaded texture data container, or nul if failed.</returns>
[Unmanaged]
public TextureData DownloadData()
{
var result = new TextureData();
return DownloadData(result) ? null : result;
}
}
partial class TextureBase
{
/// <summary>
@@ -1362,7 +1362,12 @@ namespace Flax.Build.Bindings
var apiType = FindApiTypeInfo(buildData, parameterInfo.Type, caller);
if (apiType != null)
{
if (parameterInfo.IsOut)
if (parameterInfo.IsOut && parameterInfo.Type.IsRef && !parameterInfo.Type.IsPtr && apiType.IsScriptingObject)
{
contents.Append(indent).AppendFormat("{1}* {0}Temp = New<{1}>();", parameterInfo.Name, parameterInfo.Type.GetFullNameNative(buildData, caller, false)).AppendLine();
callParams += "*";
}
else if (parameterInfo.IsOut)
contents.Append(indent).AppendFormat("{1} {0}Temp;", parameterInfo.Name, parameterInfo.Type.GetFullNameNative(buildData, caller, false)).AppendLine();
else
contents.Append(indent).AppendFormat("auto {0}Temp = {1};", parameterInfo.Name, param).AppendLine();