Skip to content

Add HLSL compilation support#89

Draft
ArthurVasseur wants to merge 3 commits intoNazaraEngine:mainfrom
ArthurVasseur:feature/hlsl
Draft

Add HLSL compilation support#89
ArthurVasseur wants to merge 3 commits intoNazaraEngine:mainfrom
ArthurVasseur:feature/hlsl

Conversation

@ArthurVasseur
Copy link
Copy Markdown

  • Updated Compiler.cpp to include HLSL compilation options and methods.
  • Added CompileToHLSL function
  • Enhanced command-line options to support HLSL version specification.
  • Created HlslTests.cpp to validate HLSL output
  • Extended ShaderUtils to include ExpectHLSL

- Updated Compiler.cpp to include HLSL compilation options and methods.
- Added CompileToHLSL function
- Enhanced command-line options to support HLSL version specification.
- Created HlslTests.cpp to validate HLSL output
- Extended ShaderUtils to include ExpectHLSL
@ArthurVasseur ArthurVasseur marked this pull request as draft March 31, 2026 20:04
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 3, 2026

Codecov Report

❌ Patch coverage is 49.29750% with 830 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.22%. Comparing base (6e2344c) to head (87f4163).

Files with missing lines Patch % Lines
src/NZSL/HlslWriter.cpp 47.60% 787 Missing ⚠️
src/ShaderCompiler/Compiler.cpp 4.87% 39 Missing ⚠️
tests/src/Tests/ShaderUtils.cpp 89.47% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
- Coverage   76.91%   75.22%   -1.69%     
==========================================
  Files         200      204       +4     
  Lines       25126    26764    +1638     
  Branches     7747     8343     +596     
==========================================
+ Hits        19325    20133     +808     
- Misses       5701     6529     +828     
- Partials      100      102       +2     
Files with missing lines Coverage Δ
include/NZSL/HlslWriter.hpp 100.00% <100.00%> (ø)
include/NZSL/HlslWriter.inl 100.00% <100.00%> (ø)
src/ShaderCompiler/Compiler.hpp 100.00% <ø> (ø)
tests/src/Tests/HlslTests.cpp 100.00% <100.00%> (ø)
tests/src/Tests/ShaderUtils.cpp 73.33% <89.47%> (+2.64%) ⬆️
src/ShaderCompiler/Compiler.cpp 49.59% <4.87%> (-4.00%) ⬇️
src/NZSL/HlslWriter.cpp 47.60% <47.60%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e2344c...87f4163. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SirLynix
Copy link
Copy Markdown
Contributor

SirLynix commented Apr 3, 2026

That's really great, thanks a lot.

However before I can consider merging to the main branch:

  • We need way more tests.
  • We need a HLSL compiler to validate the generated code, we can probably use the directxshadercompiler package (Windows/Linux only)
  • NZSL should be able to emit functions like matrix inversion when required
  • We should do something for separate image / sampler, we have the same issue with WGSL and MSL (@Kbz-8)

@Kbz-8
Copy link
Copy Markdown
Contributor

Kbz-8 commented Apr 3, 2026

We should do something for separate image / sampler

This seems quite easy to do with a Transformer. The only problem is finding a clever way to let the user know which bindings have been changed.

Use the directxshadercompiler package (optional, Windows/Linux only) to
compile each generated HLSL output through DXC (SM 6.6)
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.

3 participants