Skip to content

Commit 99b9cd7

Browse files
committed
🐛 Fixed registration texture array from unity->opengl->CUDA
1 parent 076c74b commit 99b9cd7

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

InteropUnityCUDA/Assets/Actions/InteropHandlerSample.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ private void CreateTexture()
5656

5757
private void CreateTextureArray()
5858
{
59+
_renderTextureArray = new RenderTexture(_sizeTexture, _sizeTexture, 0
60+
, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear)
61+
{
62+
useMipMap = false,
63+
autoGenerateMips = false,
64+
anisoLevel = 6,
65+
filterMode = FilterMode.Trilinear,
66+
wrapMode = TextureWrapMode.Clamp,
67+
enableRandomWrite = true,
68+
volumeDepth = 3,
69+
dimension = TextureDimension.Tex2DArray
70+
};
71+
72+
5973
_renderTextureForDisplay0 = new RenderTexture(_sizeTexture, _sizeTexture, 0
6074
, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear)
6175
{
@@ -78,7 +92,8 @@ private void CreateTextureArray()
7892
enableRandomWrite = true
7993
};
8094

81-
_rawImageOneTexture.texture = _renderTextureForDisplay0;
95+
_renderTextureArray.Create();
96+
_rawImageTextureArray0.texture = _renderTextureForDisplay0;
8297
_rawImageTextureArray1.texture = _renderTextureForDisplay1;
8398
}
8499

Binary file not shown.

InteropUnityCUDA/Assets/Plugin/PluginInteropUnityCUDA.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.

InteropUnityCUDA/Assets/Plugin/PluginInteropUnityCUDA.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.
0 Bytes
Binary file not shown.

Plugin/SampleBasic/src/actionSampleTextureArray.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace SampleBasic {
1010

1111
ActionSampleTextureArray::ActionSampleTextureArray(void* texturePtr, int width, int height, int depth) : Action()
1212
{
13-
_texture = CreateTextureInterop(texturePtr, width, height, 1);
13+
_texture = CreateTextureInterop(texturePtr, width, height, depth);
1414
}
1515

1616

@@ -22,7 +22,6 @@ namespace SampleBasic {
2222

2323
int ActionSampleTextureArray::Update()
2424
{
25-
2625
cudaSurfaceObject_t surf = _texture->mapTextureToSurfaceObject();
2726
kernelCallerWriteTextureArray(_texture->getDimBlock(), _texture->getDimBlock(), surf, GetTime(), _texture->getWidth(), _texture->getHeight(), _texture->getDepth());
2827
cudaDeviceSynchronize();

0 commit comments

Comments
 (0)