This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] Add RWBuffer default constructor
ClosedPublic

Authored by beanz on Jul 18 2022, 8:12 AM.

Details

Summary

This fills out the default constructor for RWBuffer to assign the
handle with the result of __builtin_hlsl_create_handle which we can
then treat as a pointer to the resource data through the mid-level of
the compiler.

Depends on D130016

Diff Detail

Event Timeline

beanz created this revision.Jul 18 2022, 8:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 8:13 AM
beanz requested review of this revision.Jul 18 2022, 8:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 8:13 AM
bogner accepted this revision.Jul 27 2022, 11:57 AM

Is it worth adding a test that calls this constructor / checks that we end up with a call to the builtin?

clang/lib/Sema/HLSLExternalSemaSource.cpp
155

In this case it just creates a literal so it's technically fine, but in general seeing these "emit" functions in argument lists can lead to things like the generated IR being in a different order depending on the compiler. Better to store the Expr in a variable as a matter of style.

This revision is now accepted and ready to land.Jul 27 2022, 11:57 AM
This revision was landed with ongoing or failed builds.Jul 28 2022, 12:08 PM
This revision was automatically updated to reflect the committed changes.