Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/dxc/dxcapi.internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ enum LEGAL_INTRINSIC_COMPTYPES {
LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS = 61,
LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY = 62,
LICOMPTYPE_VK_SAMPLED_TEXTURE3D = 63,
LICOMPTYPE_COUNT = 64
LICOMPTYPE_VK_SAMPLED_TEXTURECUBE = 64,
LICOMPTYPE_VK_SAMPLED_TEXTURECUBE_ARRAY = 65,
LICOMPTYPE_COUNT = 66
#else
LICOMPTYPE_COUNT = 56
#endif
Expand Down
5 changes: 4 additions & 1 deletion tools/clang/lib/SPIRV/LowerTypeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,10 @@ const SpirvType *LowerTypeVisitor::lowerVkTypeInVkNamespace(
const spv::Dim dimension =
suffix.startswith("1D")
? spv::Dim::Dim1D
: (suffix.startswith("2D") ? spv::Dim::Dim2D : spv::Dim::Dim3D);
: (suffix.startswith("2D")
? spv::Dim::Dim2D
: (suffix.startswith("3D") ? spv::Dim::Dim3D
: spv::Dim::Cube));
const bool isArray = suffix.endswith("Array");
const bool isMS = suffix.find("MS") != StringRef::npos;

Expand Down
2 changes: 2 additions & 0 deletions tools/clang/lib/SPIRV/SpirvEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4417,6 +4417,8 @@ SpirvEmitter::processBufferTextureGetDimensions(const CXXMemberCallExpr *expr) {
(typeName == "SampledTexture1DArray" && numArgs > 2) ||
(typeName == "SampledTexture2D" && numArgs > 2) ||
(typeName == "SampledTexture2DArray" && numArgs > 3) ||
(typeName == "SampledTextureCUBE" && numArgs > 2) ||
(typeName == "SampledTextureCUBEArray" && numArgs > 3) ||
(typeName == "SampledTexture3D" && numArgs > 3) ||
(typeName == "TextureCube" && numArgs > 2) ||
(typeName == "Texture3D" && numArgs > 3) ||
Expand Down
37 changes: 35 additions & 2 deletions tools/clang/lib/Sema/SemaHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ enum ArBasicKind {
AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY,
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS,
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY,
AR_OBJECT_VK_SAMPLED_TEXTURECUBE,
AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY,
AR_OBJECT_VK_SAMPLED_TEXTURE3D,
#endif // ENABLE_SPIRV_CODEGEN
// SPIRV change ends
Expand Down Expand Up @@ -573,6 +575,8 @@ const UINT g_uBasicKindProps[] = {
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURECUBE
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY
BPROP_OBJECT | BPROP_RBUFFER, // AR_OBJECT_VK_SAMPLED_TEXTURE3D
#endif // ENABLE_SPIRV_CODEGEN
// SPIRV change ends
Expand Down Expand Up @@ -1294,6 +1298,10 @@ static const ArBasicKind g_VKSampledTexture2DMSCT[] = {
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS, AR_BASIC_UNKNOWN};
static const ArBasicKind g_VKSampledTexture2DMSArrayCT[] = {
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_BASIC_UNKNOWN};
static const ArBasicKind g_VKSampledTextureCUBECT[] = {
AR_OBJECT_VK_SAMPLED_TEXTURECUBE, AR_BASIC_UNKNOWN};
static const ArBasicKind g_VKSampledTextureCUBEArrayCT[] = {
AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY, AR_BASIC_UNKNOWN};
static const ArBasicKind g_VKSampledTexture3DCT[] = {
AR_OBJECT_VK_SAMPLED_TEXTURE3D, AR_BASIC_UNKNOWN};
#endif
Expand Down Expand Up @@ -1365,6 +1373,8 @@ const ArBasicKind *g_LegalIntrinsicCompTypes[] = {
g_VKSampledTexture2DArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2D_ARRAY
g_VKSampledTexture2DMSCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS
g_VKSampledTexture2DMSArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE2DMS_ARRAY
g_VKSampledTextureCUBECT, // LICOMPTYPE_VK_SAMPLED_TEXTURECUBE
g_VKSampledTextureCUBEArrayCT, // LICOMPTYPE_VK_SAMPLED_TEXTURECUBE_ARRAY
g_VKSampledTexture3DCT, // LICOMPTYPE_VK_SAMPLED_TEXTURE3D
#endif
};
Expand Down Expand Up @@ -1428,7 +1438,8 @@ static const ArBasicKind g_ArBasicKindsAsTypes[] = {
AR_OBJECT_VK_BUFFER_POINTER, AR_OBJECT_VK_SAMPLED_TEXTURE1D,
AR_OBJECT_VK_SAMPLED_TEXTURE1D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2D,
AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE2DMS,
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE3D,
AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURECUBE,
AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY, AR_OBJECT_VK_SAMPLED_TEXTURE3D,
#endif // ENABLE_SPIRV_CODEGEN
// SPIRV change ends

Expand Down Expand Up @@ -1546,6 +1557,8 @@ static const uint8_t g_ArBasicKindsTemplateCount[] = {
1, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY
1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS
1, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY
1, // AR_OBJECT_VK_SAMPLED_TEXTURECUBE
1, // AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY
1, // AR_OBJECT_VK_SAMPLED_TEXTURE3D
#endif // ENABLE_SPIRV_CODEGEN
// SPIRV change ends
Expand Down Expand Up @@ -1706,6 +1719,8 @@ static const SubscriptOperatorRecord g_ArBasicKindsSubscripts[] = {
{3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY
{2, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS
{3, MipsFalse, SampleTrue}, // AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY
{0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURECUBE
{0, MipsFalse, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY
{3, MipsTrue, SampleFalse}, // AR_OBJECT_VK_SAMPLED_TEXTURE3D
#endif // ENABLE_SPIRV_CODEGEN
// SPIRV change ends
Expand Down Expand Up @@ -1882,6 +1897,8 @@ static const char *g_ArBasicTypeNames[] = {
"SampledTexture2DArray",
"SampledTexture2DMS",
"SampledTexture2DMSArray",
"SampledTextureCUBE",
"SampledTextureCUBEArray",
"SampledTexture3D",
#endif // ENABLE_SPIRV_CODEGEN
// SPIRV change ends
Expand Down Expand Up @@ -2563,6 +2580,14 @@ static void GetIntrinsicMethods(ArBasicKind kind,
*intrinsics = g_VkSampledTexture2DMSArrayMethods;
*intrinsicCount = _countof(g_VkSampledTexture2DMSArrayMethods);
break;
case AR_OBJECT_VK_SAMPLED_TEXTURECUBE:
*intrinsics = g_VkSampledTextureCUBEMethods;
*intrinsicCount = _countof(g_VkSampledTextureCUBEMethods);
break;
case AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY:
*intrinsics = g_VkSampledTextureCUBEArrayMethods;
*intrinsicCount = _countof(g_VkSampledTextureCUBEArrayMethods);
break;
case AR_OBJECT_VK_SAMPLED_TEXTURE3D:
*intrinsics = g_VkSampledTexture3DMethods;
*intrinsicCount = _countof(g_VkSampledTexture3DMethods);
Expand Down Expand Up @@ -4178,7 +4203,9 @@ class HLSLExternalSource : public ExternalSemaSource {
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2D_ARRAY ||
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS ||
kind == AR_OBJECT_VK_SAMPLED_TEXTURE2DMS_ARRAY ||
kind == AR_OBJECT_VK_SAMPLED_TEXTURE3D) {
kind == AR_OBJECT_VK_SAMPLED_TEXTURE3D ||
kind == AR_OBJECT_VK_SAMPLED_TEXTURECUBE ||
kind == AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY) {
if (!m_vkNSDecl)
continue;
QualType float4Type =
Expand Down Expand Up @@ -5174,10 +5201,16 @@ class HLSLExternalSource : public ExternalSemaSource {
ResClass = DXIL::ResourceClass::UAV;
return true;
case AR_OBJECT_TEXTURECUBE:
#ifdef ENABLE_SPIRV_CODEGEN
case AR_OBJECT_VK_SAMPLED_TEXTURECUBE:
#endif
ResKind = DXIL::ResourceKind::TextureCube;
ResClass = DXIL::ResourceClass::SRV;
return true;
case AR_OBJECT_TEXTURECUBE_ARRAY:
#ifdef ENABLE_SPIRV_CODEGEN
case AR_OBJECT_VK_SAMPLED_TEXTURECUBE_ARRAY:
#endif
ResKind = DXIL::ResourceKind::TextureCubeArray;
ResClass = DXIL::ResourceClass::SRV;
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability ImageQuery
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> tex;

void main() {
float3 xyz = float3(0.5, 0.25, 0.75);

// CHECK: [[tex_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %tex
// CHECK: [[xyz_load:%[a-zA-Z0-9_]+]] = OpLoad %v3float %xyz
// CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex_load]] [[xyz_load]]
// CHECK: {{%[0-9]+}} = OpCompositeExtract %float [[lod_query]] 1
float lod = tex.CalculateLevelOfDetailUnclamped(xyz);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability ImageQuery
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> tex;

void main() {
float3 xyz = float3(0.5, 0.25, 0.75);

// CHECK: [[tex_load:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %tex
// CHECK: [[xyz_load:%[a-zA-Z0-9_]+]] = OpLoad %v3float %xyz
// CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex_load]] [[xyz_load]]
// CHECK: {{%[0-9]+}} = OpCompositeExtract %float [[lod_query]] 0
float lod = tex.CalculateLevelOfDetail(xyz);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability SparseResidency

// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0_75
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> texf4;

float4 main() : SV_Target {
// CHECK: [[tex0:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[a:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex0]] [[v3fc]] %int_3 None
float4 a = texf4.GatherAlpha(float3(0.5, 0.25, 0.75));

uint status;
// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[b_sparse:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1]] [[v3fc]] %int_3 None
// CHECK: [[status0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[b_sparse]] 0
// CHECK: OpStore %status [[status0]]
float4 b = texf4.GatherAlpha(float3(0.5, 0.25, 0.75), status);

return a + b;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability SparseResidency

// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0_75
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> texf4;

float4 main() : SV_Target {
// CHECK: [[tex0:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[a:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex0]] [[v3fc]] %int_2 None
float4 a = texf4.GatherBlue(float3(0.5, 0.25, 0.75));

uint status;
// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[b_sparse:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1]] [[v3fc]] %int_2 None
// CHECK: [[status0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[b_sparse]] 0
// CHECK: OpStore %status [[status0]]
float4 b = texf4.GatherBlue(float3(0.5, 0.25, 0.75), status);

return a + b;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: not %dxc -T ps_6_8 -E main -fcgl %s -spirv 2>&1 | FileCheck %s

vk::SampledTextureCUBE<float4> tex;

float4 main() : SV_Target {
float4 a = tex.GatherCmpAlpha(float3(0.5, 0.25, 0.75), 0.25f);
uint status;
float4 b = tex.GatherCmpAlpha(float3(0.5, 0.25, 0.75), 0.25f, status);
return a + b;
}

// CHECK: error: no equivalent for GatherCmpAlpha intrinsic method in Vulkan
// CHECK: error: no equivalent for GatherCmpAlpha intrinsic method in Vulkan
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: not %dxc -T ps_6_8 -E main -fcgl %s -spirv 2>&1 | FileCheck %s

vk::SampledTextureCUBE<float4> tex;

float4 main() : SV_Target {
float4 a = tex.GatherCmpBlue(float3(0.5, 0.25, 0.75), 0.25f);
uint status;
float4 b = tex.GatherCmpBlue(float3(0.5, 0.25, 0.75), 0.25f, status);
return a + b;
}

// CHECK: error: no equivalent for GatherCmpBlue intrinsic method in Vulkan
// CHECK: error: no equivalent for GatherCmpBlue intrinsic method in Vulkan
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: not %dxc -T ps_6_8 -E main -fcgl %s -spirv 2>&1 | FileCheck %s

vk::SampledTextureCUBE<float4> tex;

float4 main() : SV_Target {
float4 a = tex.GatherCmpGreen(float3(0.5, 0.25, 0.75), 0.25f);
uint status;
float4 b = tex.GatherCmpGreen(float3(0.5, 0.25, 0.75), 0.25f, status);
return a + b;
}

// CHECK: error: no equivalent for GatherCmpGreen intrinsic method in Vulkan
// CHECK: error: no equivalent for GatherCmpGreen intrinsic method in Vulkan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability SparseResidency

// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0_75
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> tex;

float4 main() : SV_Target {
// CHECK: [[tex0:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %tex
// CHECK: [[a:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex0]] [[v3fc]] %float_0_25 None
float4 a = tex.GatherCmpRed(float3(0.5, 0.25, 0.75), 0.25f);

uint status;
// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %tex
// CHECK: [[b_sparse:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather %SparseResidencyStruct [[tex1]] [[v3fc]] %float_0_25 None
// CHECK: [[status0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[b_sparse]] 0
// CHECK: OpStore %status [[status0]]
float4 b = tex.GatherCmpRed(float3(0.5, 0.25, 0.75), 0.25f, status);

return a + b;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability SparseResidency

// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0_75
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> tex;

float4 main() : SV_Target {
// CHECK: [[tex0:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %tex
// CHECK: [[a:%[a-zA-Z0-9_]+]] = OpImageDrefGather %v4float [[tex0]] [[v3fc]] %float_0_25 None
float4 a = tex.GatherCmp(float3(0.5, 0.25, 0.75), 0.25f);

uint status;
// CHECK: [[tex5:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %tex
// CHECK: [[f_sparse:%[a-zA-Z0-9_]+]] = OpImageSparseDrefGather %SparseResidencyStruct [[tex5]] [[v3fc]] %float_0_25 None
// CHECK: [[status0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[f_sparse]] 0
// CHECK: OpStore %status [[status0]]
float4 f = tex.GatherCmp(float3(0.5, 0.25, 0.75), 0.25f, status);

return a + f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability SparseResidency

// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0_75
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> texf4;

float4 main() : SV_Target {
// CHECK: [[tex0:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[a:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex0]] [[v3fc]] %int_1 None
float4 a = texf4.GatherGreen(float3(0.5, 0.25, 0.75));

uint status;
// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[b_sparse:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1]] [[v3fc]] %int_1 None
// CHECK: [[status0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[b_sparse]] 0
// CHECK: OpStore %status [[status0]]
float4 b = texf4.GatherGreen(float3(0.5, 0.25, 0.75), status);

return a + b;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s

// CHECK: OpCapability SparseResidency

// CHECK: [[v3fc:%[0-9]+]] = OpConstantComposite %v3float %float_0_5 %float_0_25 %float_0_75
// CHECK: [[type_cube_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float Cube 0 0 0 1 Unknown
// CHECK: [[type_cube_sampled:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_cube_image]]

vk::SampledTextureCUBE<float4> texf4;

float4 main() : SV_Target {
// CHECK: [[tex0:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[a:%[a-zA-Z0-9_]+]] = OpImageGather %v4float [[tex0]] [[v3fc]] %int_0 None
float4 a = texf4.GatherRed(float3(0.5, 0.25, 0.75));

uint status;
// CHECK: [[tex1:%[a-zA-Z0-9_]+]] = OpLoad [[type_cube_sampled]] %texf4
// CHECK: [[b_sparse:%[a-zA-Z0-9_]+]] = OpImageSparseGather %SparseResidencyStruct [[tex1]] [[v3fc]] %int_0 None
// CHECK: [[status0:%[a-zA-Z0-9_]+]] = OpCompositeExtract %uint [[b_sparse]] 0
// CHECK: OpStore %status [[status0]]
float4 b = texf4.GatherRed(float3(0.5, 0.25, 0.75), status);

return a + b;
}
Loading
Loading