[Bug 298058] graphics/dxc: New port: Microsoft's HLSL to SPIR-V shader compiler

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 30 Aug 2026 17:28:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298058

            Bug ID: 298058
           Summary: graphics/dxc: New port: Microsoft's HLSL to SPIR-V
                    shader compiler
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
               URL: https://github.com/microsoft/DirectXShaderCompiler
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: bsdcode@disroot.org
 Attachment #274278 maintainer-approval+
             Flags:

Created attachment 274278
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=274278&action=edit
graphics/dxc: New port: Microsoft's HLSL to SPIR-V shader compiler

The DirectX Shader Compiler project includes a compiler and related
tools used to compile High-Level Shader Language (HLSL) programs into
DirectX Intermediate Language (DXIL) for DirectX and the Standard
Portable Intermediate Representation (SPIR-V) for Vulkan.

Applications that make use of DirectX or Vulkan for graphics, games, and
computation can use it to generate shader program binaries.


portclippy: OK
portfmt:    OK (reasonably)
portlint:   OK
make test:  OK

Build and tested on amd64 15.0-RELEASE.


My usecase for this port is to support Vulkan-based hardware rendering in the
Ymir emulator project, which relies on compiling HLSL shaders into SPIR-V
representation and is explicitly not compatible with the HLSL support in
graphics/glslang. It requires DXC, the Microsoft's DirectX Shader Compiler. The
development of hardware rendering and the Vulkan-based renderer is still
ongoing and not in the current release version of Ymir ported in
emulators/Ymir. But having it in the ports tree now will allow to unbreak the
project's CI, and eventually be needed for a future upgrade of the
emulators/Ymir port.

Also, glslang has put up a notice for deprecating its HLSL support, see
https://github.com/KhronosGroup/glslang#news:

> The HLSL front-end is deprecated as of April 2026 and will be removed at the next
> major version of glslang.
So having dxc in the ports tree might also help current consumers of
graphics/glslang, which only support HLSL instead of GLSL, when the need arises
in the future.


Some porting notes for the brave reviewers:

1) I named the port "dxc". This seems to be an accepted and acknowledged
referencial name for the compiler. But naming it "dxcompiler",
"directxshadercompiler", or something else would certainly not be wrong. I'll
happily accept suggestions for renaming the port if the current name is deemed
inappropriate for any reason.

2) The build process looks for unneeded dependencies on the build host, i.e.
libxml2, MetalIRConverter, Go and OCaml. The first two can be shut down with an
CMAKE_DISABLE_FIND_PACKAGE_. For Go and OCaml I think the ruthless deletion of
these parts was the most obvious way.

3) The "DxilContainerCompilerVersionTest" fails with an exception in `make
test`. I currently don't have the capacity to look into this, and to the best
of my knowledge this is harmless (I could be wrong). So I removed this test in
order for 'make test' to run through. And every other test succeeds.

-- 
You are receiving this mail because:
You are the assignee for the bug.