Skip to content

Commit 02f042a

Browse files
author
david.algis
committed
✨ Make texture array edition possible with cuda
1 parent 99b9cd7 commit 02f042a

16 files changed

+27
-12
lines changed

InteropUnityCUDA/Assets/Actions/InteropHandlerSample.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ private void CreateTexture()
5151
enableRandomWrite = true
5252
};
5353

54+
_renderTexture.Create();
5455
_rawImageOneTexture.texture = _renderTexture;
5556
}
5657

@@ -122,19 +123,19 @@ protected override void InitializeActions()
122123
Debug.LogError("Set particles drawer in inspector !");
123124
return;
124125
}
125-
126+
126127
CreateBuffer();
127128
CreateTexture();
128129
CreateTextureArray();
129130
ActionUnitySampleTexture actionUnitySampleTexture = new ActionUnitySampleTexture(_renderTexture);
130-
ActionUnitySampleTextureArray actionUnitySampleTextureArray = new ActionUnitySampleTextureArray(_renderTexture);
131131
ActionUnitySampleVertexBuffer actionUnitySampleVertexBuffer = new ActionUnitySampleVertexBuffer(_computeBuffer, _sizeBuffer);
132+
ActionUnitySampleTextureArray actionUnitySampleTextureArray = new ActionUnitySampleTextureArray(_renderTextureArray);
132133
RegisterActionUnity(actionUnitySampleTexture, _ActionTextureName);
133134
RegisterActionUnity(actionUnitySampleVertexBuffer, _ActionVertexBufferName);
134135
RegisterActionUnity(actionUnitySampleTextureArray, _ActionTextureArrayName);
135136
CallFunctionStartInAction(_ActionTextureName);
136-
CallFunctionStartInAction(_ActionTextureArrayName);
137137
CallFunctionStartInAction(_ActionVertexBufferName);
138+
CallFunctionStartInAction(_ActionTextureArrayName);
138139
}
139140

140141

@@ -144,8 +145,13 @@ protected override void InitializeActions()
144145
protected override void UpdateActions()
145146
{
146147
base.UpdateActions();
148+
CallFunctionUpdateInAction(_ActionTextureArrayName);
147149
CallFunctionUpdateInAction(_ActionTextureName);
148150
CallFunctionUpdateInAction(_ActionVertexBufferName);
151+
Graphics.CopyTexture(_renderTextureArray,0,_renderTextureForDisplay0,0);
152+
Graphics.CopyTexture(_renderTextureArray,1,_renderTextureForDisplay1,0);
153+
_rawImageTextureArray0.texture = _renderTextureForDisplay0;
154+
_rawImageTextureArray1.texture = _renderTextureForDisplay1;
149155
}
150156

151157
/// <summary>
@@ -154,6 +160,7 @@ protected override void UpdateActions()
154160
protected override void OnDestroyActions()
155161
{
156162
base.OnDestroyActions();
163+
CallFunctionOnDestroyInAction(_ActionTextureArrayName);
157164
CallFunctionOnDestroyInAction(_ActionTextureName);
158165
CallFunctionOnDestroyInAction(_ActionVertexBufferName);
159166
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
-354 KB
Binary file not shown.
39 Bytes
Binary file not shown.

InteropUnityCUDA/Assets/Plugin/SampleBasic.exp.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 Bytes
Binary file not shown.

InteropUnityCUDA/Assets/Plugin/SampleBasic.lib.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-124 KB
Binary file not shown.

0 commit comments

Comments
 (0)