Skip to content

Commit

Permalink
Fix spirv legalization of nested ararys. (#3567)
Browse files Browse the repository at this point in the history
* Fix spirv legalization of nested ararys.

* Fix test.
  • Loading branch information
csyonghe authored Feb 11, 2024
1 parent 20ab161 commit 03cddba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions source/slang/slang-ir-spirv-legalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase
}

for (auto i : instsToRemove)
if (!i->hasUses())
i->removeAndDeallocate();
i->removeAndDeallocate();
}

// Returns true if the given type that should be decorated as in `UniformConstant` address space.
Expand Down
12 changes: 12 additions & 0 deletions tests/spirv/array-of-array.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage compute -emit-spirv-directly -skip-spirv-validation

Texture2D texArray[3][4][5];
RWStructuredBuffer<float4> outputBuffer;

// CHECK: OpEntryPoint

[shader("compute")]
void main(uint3 tid : SV_DispatchThreadID)
{
outputBuffer[0] = texArray[tid.x][tid.y][tid.z].Load(int3(1,2,3));
}

0 comments on commit 03cddba

Please sign in to comment.