Skip to content

d3d12: Fix shaders failing to compile with newer dxc versions

Monty C requested to merge montyc/gstreamer:1.24-fix-dxc-error into 1.24

Currently, the 1.24 branch fails to build on the latest Windows SDK, which ships with dxc 1.7.2308.

FAILED: sys/d3d12/hlsl/VSMain_color.h 
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\\x64\dxc.EXE" "/Fh" "sys/d3d12/hlsl/VSMain_color.h" "/E" "VSMain_color" "/T" "vs_6_0" "/all-resources-bound" "../sys/d3d12/hlsl/VSMain_color.hlsl"
../sys/d3d12/hlsl/VSMain_color.hlsl:34:10: error: cannot initialize return object of type 'VS_OUTPUT' with an lvalue of type 'VS_INPUT'

  return input;

         ^~~~~

This is because the DirectX compiler now uses HLSL 2021 by default, which disallows implicit casting of structs.

See: https://godbolt.org/z/6Go76xbo6

It looks like dxc is not used at all in the main branch, so this change is only necessary for 1.24.

Edited by Monty C

Merge request reports

Loading