Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template support #3533

Merged
merged 1 commit into from Mar 3, 2021
Merged

Template support #3533

merged 1 commit into from Mar 3, 2021

Conversation

tcorringham
Copy link
Collaborator

@tcorringham tcorringham commented Mar 3, 2021

Template support for HLSL

  • can be enabled using command line option -enable-templates
  • supports both function templates and aggregate templates
  • support is more or less equivalent to that in C++98
  • use of template features and syntax introduced by C++11 or later may
    not be handled gracefully

@AppVeyorBot
Copy link

@AppVeyorBot AppVeyorBot commented Mar 3, 2021

Template support for HLSL
- can be enabled using command line option -enable-templates
- supports both function templates and aggregate templates
- support is more or less equivalent to that in C++98
- use of template features and syntax introduced by C++11 or later may
  not be handled gracefully
@AppVeyorBot
Copy link

@AppVeyorBot AppVeyorBot commented Mar 3, 2021

@pow2clk pow2clk merged commit a342872 into microsoft:hlsl-2021 Mar 3, 2021
2 checks passed
@tcorringham tcorringham deleted the hlsl-2021 branch Mar 4, 2021
Jasper-Bekkers pushed a commit to Traverse-Research/DirectXShaderCompiler that referenced this issue Apr 20, 2021
Template support for HLSL
- can be enabled using command line option -enable-templates
- supports both function templates and aggregate templates
- support is more or less equivalent to that in C++98
- use of template features and syntax introduced by C++11 or later may
  not be handled gracefully

Co-authored-by: Tim Corringham <tcorring@amd.com>
@ghostplant
Copy link

@ghostplant ghostplant commented May 10, 2021

@tcorringham Hi, when can this update ported to VS2019 library components officially (for dxcompiler.dll and dxil.dll included in VS module updates)?

@pow2clk
Copy link
Member

@pow2clk pow2clk commented May 10, 2021

Here is the comment I made on when the template work might make it into the main branch: #3696 (comment)

The subject of when this will find its way to visual studio's included components is largely out of the hands of the maintainers of this project at present. That mechanism may be about to change though. I'll copy what I said in another forum on the subject:

We are well aware of what a pain it is to get a dxc compiler in Visual Studio that is less than a year old 😕. We are looking into solutions for this of which nuget is one possibility. The other would be an amicable conscious uncoupling of Visual Studio and DXC with detailed instructions on how to include a customized build for hlsl files (https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build). This would be accompanied by improvements in DXC that would allow simple navigation to errors without the current hidden tricks to make that work.

I am interested in the community's thoughts on the subject!

pow2clk added a commit that referenced this issue Sep 23, 2021
* Template support (#3533)

Template support for HLSL
- can be enabled using command line option -enable-templates
- supports both function templates and aggregate templates
- support is more or less equivalent to that in C++98
- use of template features and syntax introduced by C++11 or later may
  not be handled gracefully

Co-authored-by: Tim Corringham <tcorring@amd.com>

* [spirv] use rvalue for array index (#3616)

The newly introduced template support generates a template instance
of a struct method that has a slightly different AST from the one
with hard-coded type. The template instance misses LValueToRValue
cast for an array index. This PR lets SPIR-V backend uses rvalue for
an array index. If the array index expression is not rvalue, it reports
an error.

* [templates] Fix issues with dependent template names (#3634)

Errors were reported for the use of some dependent template names
in cases where the code should have been accepted, caused by the
incorrect handling of some HLSL cases - which are fixed by this
change.

Fixes #3556

* [spirv] add unit test to check function template instance (#3688)

The function template instance works fine while the struct/class template
instance has some issues, but we want to add an unit test for the function
template instance to make sure it works fine.

* [spirv] Handle class template instance (#3687)

This change correctly generates struct type for the following template
instance:
```
template <typename T>
struct Foo { ... use T ... }

...

Foo<int>
Foo<float>
...
```

Fixes #3557

* Fix test failure on AddMulOps.hlsl

Author: Adam Yang

* Enables HLSL bitfields. (#3847)

* Warns when semantic name same as integral/enum identifier. (#3866)

Intent is to avoid confusion where C++ syntax would allow named constant as bitfield width, which is disallowed in HLSL because of conflict with syntax for semantics.

* -strict-udt-casting prevents implicit casts between unrelated structs (#3891)

* Add -enable-short-circuit option for operators &&, ||, :? (#3892)

* Initial support of operator overloading (#3859)

* Short circuit tests. (#3917)

* Limit Sema intrinsic checks to builtin "op" table (#3963)


The check for short curcuit intrinsics failed to account for
intrinsic tables other than the default. This ensures that assumption is
correct before performing the check

Added a few other checks for similar uses

Co-authored-by: Tim Corringham <timothy.corringham@amd.com>
Co-authored-by: Tim Corringham <tcorring@amd.com>
Co-authored-by: Jaebaek Seo <jaebaek@google.com>
Co-authored-by: Helena Kotas <hekotas@microsoft.com>
Co-authored-by: danbrown-amd <61992655+danbrown-amd@users.noreply.github.com>
Co-authored-by: Tex Riddell <texr@microsoft.com>
Co-authored-by: Adam Yang <31109344+adam-yang@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants