Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 18 additions & 6 deletions tools/clang/lib/Sema/SemaHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3817,29 +3817,41 @@ class HLSLExternalSource : public ExternalSemaSource {
recordDecl = m_ThreadNodeOutputRecordsTemplateDecl->getTemplatedDecl();
}
#ifdef ENABLE_SPIRV_CODEGEN
else if (kind == AR_OBJECT_VK_SPIRV_TYPE && m_vkNSDecl) {
else if (kind == AR_OBJECT_VK_SPIRV_TYPE) {
if (!m_vkNSDecl)
continue;
recordDecl =
DeclareInlineSpirvType(*m_context, m_vkNSDecl, typeName, false);
recordDecl->setImplicit(true);
} else if (kind == AR_OBJECT_VK_SPIRV_OPAQUE_TYPE && m_vkNSDecl) {
} else if (kind == AR_OBJECT_VK_SPIRV_OPAQUE_TYPE) {
if (!m_vkNSDecl)
continue;
recordDecl =
DeclareInlineSpirvType(*m_context, m_vkNSDecl, typeName, true);
recordDecl->setImplicit(true);
} else if (kind == AR_OBJECT_VK_INTEGRAL_CONSTANT && m_vkNSDecl) {
} else if (kind == AR_OBJECT_VK_INTEGRAL_CONSTANT) {
if (!m_vkNSDecl)
continue;
recordDecl =
DeclareVkIntegralConstant(*m_context, m_vkNSDecl, typeName,
&m_vkIntegralConstantTemplateDecl);
recordDecl->setImplicit(true);
} else if (kind == AR_OBJECT_VK_LITERAL && m_vkNSDecl) {
} else if (kind == AR_OBJECT_VK_LITERAL) {
if (!m_vkNSDecl)
continue;
recordDecl = DeclareTemplateTypeWithHandleInDeclContext(
*m_context, m_vkNSDecl, typeName, 1, nullptr);
recordDecl->setImplicit(true);
m_vkLiteralTemplateDecl = recordDecl->getDescribedClassTemplate();
} else if (kind == AR_OBJECT_VK_SPV_INTRINSIC_TYPE && m_vkNSDecl) {
} else if (kind == AR_OBJECT_VK_SPV_INTRINSIC_TYPE) {
if (!m_vkNSDecl)
continue;
recordDecl = DeclareUIntTemplatedTypeWithHandleInDeclContext(
*m_context, m_vkNSDecl, typeName, "id");
recordDecl->setImplicit(true);
} else if (kind == AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID && m_vkNSDecl) {
} else if (kind == AR_OBJECT_VK_SPV_INTRINSIC_RESULT_ID) {
if (!m_vkNSDecl)
continue;
recordDecl = DeclareTemplateTypeWithHandleInDeclContext(
*m_context, m_vkNSDecl, typeName, 1, nullptr);
recordDecl->setImplicit(true);
Expand Down
27 changes: 27 additions & 0 deletions tools/clang/test/CodeGenSPIRV/vk.types.in.dxil.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// RUN: not %dxc -T ps_6_0 -E PSMain -fcgl %s -DINTEGRAL_CONSTANT 2>&1 | FileCheck %s --check-prefix=INTEGRAL_CONSTANT

#ifdef INTEGRAL_CONSTANT
// INTEGRAL_CONSTANT: 5:14: error: unknown type name 'integral_constant'
static const integral_constant<uint> MyVar;
#endif

// RUN: not %dxc -T ps_6_0 -E PSMain -fcgl %s -DSPIRV_TYPE 2>&1 | FileCheck %s --check-prefix=SPIRV_TYPE

#ifdef SPIRV_TYPE
// SPIRV_TYPE: 12:14: error: unknown type name 'SpirvType'
static const SpirvType<uint> MyVar;
#endif

// RUN: not %dxc -T ps_6_0 -E PSMain -fcgl %s -DSPIRV_OPAQUE_TYPE 2>&1 | FileCheck %s --check-prefix=SPIRV_OPAQUE_TYPE

#ifdef SPIRV_OPAQUE_TYPE
// SPIRV_OPAQUE_TYPE: 19:14: error: unknown type name 'SpirvOpaqueType'
static const SpirvOpaqueType<uint> MyVar;
#endif

// RUN: not %dxc -T ps_6_0 -E PSMain -fcgl %s -DLITERAL 2>&1 | FileCheck %s --check-prefix=LITERAL

#ifdef LITERAL
// LITERAL: 26:14: error: unknown type name 'Literal'
static const Literal<uint> MyVar;
#endif