Allocate correct size for idxList in TranslateStructBufMatSubscript.

This commit is contained in:
Xiang Li 2017-08-29 18:26:49 -07:00
Родитель 13adee8411
Коммит ceb0c7aee7
2 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -5671,7 +5671,7 @@ void TranslateStructBufMatSubscript(CallInst *CI, Value *handle,
resultSize = resultType->getVectorNumElements();
DXASSERT(resultSize <= 16, "up to 4x4 elements in vector or matrix");
_Analysis_assume_(resultSize <= 16);
Value *idxList[16];
std::vector<Value *> idxList(resultSize);
switch (subOp) {
case HLSubscriptOpcode::ColMatSubscript:

Просмотреть файл

@ -0,0 +1,14 @@
// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s
// Make sure matrix indexing works for struct buf.
// CHECK: @dx.op.bufferLoad.f32
// CHECK: @dx.op.bufferStore.f32
StructuredBuffer<matrix<float, 4, 4> > buf1;
RWBuffer<float4> buf2;
[RootSignature("DescriptorTable(SRV(t0), UAV(u0))")]
[numthreads(8, 8, 1)]
void main( uint3 tid : SV_DispatchThreadID) {
buf2[tid.x] = buf1[tid.x][tid.y][tid.z];
}