-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[SPIRV] Implements vk::BufferPointer proposal #7163
base: main
Are you sure you want to change the base?
Conversation
76c4743
to
0d60681
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
0d60681
to
78eb760
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to look more, early feedback
/// <summary>Adds a constructor declaration to the specified class | ||
/// record.</summary> <param name="context">ASTContext that owns | ||
/// declarations.</param> <param name="recordDecl">Record declaration in which | ||
/// to add constructor.</param> <param name="resultType">Result type for | ||
/// constructor.</param> <param name="paramTypes">Types for constructor | ||
/// parameters.</param> <param name="paramNames">Names for constructor | ||
/// parameters.</param> <param name="declarationName">Name for | ||
/// constructor.</param> <param name="isConst">Whether the constructor is a | ||
/// const function.</param> <returns>The method declaration for the | ||
/// constructor.</returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
Is doxygen still generatable? (Couldn't make it work).
If no, might be more readable to have a normal comment.
} | ||
|
||
QualType GetVKBufferPointerBufferType(clang::QualType type) { | ||
return GetHLSLResourceTemplateParamType(type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this doesn't check the namespaceDecl?
Would it be useful to have the following:
a static std::optional<QualType> MaybeGetVKBufferPointerBufferType(QualType T)
which does the RecordType
, ClassTemplateSpec
, NamespaceDecl
checks, and returns the QualType
is all pass, and then use this to implement the 3 functions here?
IsVKBufferPointerType(T) { return MaybeGet(T).has_value(); }
GetVKBufferPointerType(T) { return MaybeGet(T).value(); }
GetVKBufferPointerAlignment(T) { return MaybeGet(T)->getTemplateArgs()[1].getAsIntegral()...; }
@@ -200,6 +203,7 @@ void CapabilityVisitor::addCapabilityForType(const SpirvType *type, | |||
} | |||
// Pointer type | |||
else if (const auto *ptrType = dyn_cast<SpirvPointerType>(type)) { | |||
sc = ptrType->getStorageClass(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall this assert sc == ptrType->getStorageClass()
instead? Is there a valid case for calling this function with the wrong sc
?
@@ -3387,6 +3420,10 @@ class HLSLExternalSource : public ExternalSemaSource { | |||
case LICOMPTYPE_VOID: | |||
paramTypes.push_back(context.VoidTy); | |||
break; | |||
case LICOMPTYPE_VK_BUFFER_POINTER: | |||
paramTypes.push_back(context.getTypeDeclType( | |||
m_objectTypeDecls[AR_OBJECT_VK_BUFFER_POINTER])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not supposed to work, the index is larger than the array size. Seems like you need to get the index first from the g_ArBasicKindsAsTypes array no?
(this also means this path is not tested)
float4 g_vSomeConstantB; | ||
}; | ||
|
||
typedef vk::BufferPointer<Globals_s> Globals_p; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like doing this crashes the compiler:
typedef vk::BufferPointer<Globals_p> Globals_pp;;
PushConstant_t {
Globals_pp bda;
}
bda.Get().Get().g_testFloat4
Implements vk::BufferPointer proposal.
Closes #6489.