[spirv] Handle resource templated by vecc1. (#3098)

This commit is contained in:
Ehsan 2020-09-03 14:26:43 -05:00 коммит произвёл GitHub
Родитель 19d8514c8a
Коммит fd65d32733
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 14 добавлений и 3 удалений

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

@ -3262,9 +3262,15 @@ SpirvInstruction *SpirvEmitter::processBufferTextureLoad(
}
}
if (!elemType->isFloatingType() && !elemType->isIntegerType()) {
emitError("loading %0 value unsupported", object->getExprLoc()) << type;
return nullptr;
{
// Treat a vector of size 1 the same as a scalar.
if (hlsl::IsHLSLVecType(elemType) && hlsl::GetHLSLVecSize(elemType) == 1)
elemType = hlsl::GetHLSLVecElementType(elemType);
if (!elemType->isFloatingType() && !elemType->isIntegerType()) {
emitError("loading %0 value unsupported", object->getExprLoc()) << type;
return nullptr;
}
}
// If residencyCode is nullptr, we are dealing with a Load method with 2

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

@ -5,6 +5,7 @@ RWTexture2D<uint2> uint2buf;
RWTexture3D<float3> float3buf;
RWTexture1DArray<float4> float4buf;
RWTexture2DArray<int3> int3buf;
RWTexture2D<float> vec1buf;
// CHECK: OpCapability SparseResidency
@ -43,6 +44,10 @@ void main() {
// CHECK-NEXT: OpStore %e [[r5]]
int3 e = int3buf.Load(0);
// CHECK: [[img6:%\d+]] = OpLoad %type_2d_image_0 %vec1buf
// CHECK-NEXT: {{%\d+}} = OpImageRead %v4float [[img6]] {{%\d+}} None
float f = vec1buf.Load(0);
uint status;
// CHECK: [[img1:%\d+]] = OpLoad %type_1d_image %intbuf
// CHECK-NEXT: [[structResult:%\d+]] = OpImageSparseRead %SparseResidencyStruct [[img1]] %int_0 None