From 3b3d41a7ea4a2f68df7a166029b0f10c3cc2b1c3 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 10 Apr 2021 12:23:30 +0200 Subject: [PATCH] gpu/internal/convertshaders: don't use Wine for the dxc tool dxc exists for Linux, and seems to work. Signed-off-by: Elias Naur --- gpu/internal/convertshaders/hlsl.go | 14 ++------------ gpu/internal/convertshaders/main.go | 5 ++++- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gpu/internal/convertshaders/hlsl.go b/gpu/internal/convertshaders/hlsl.go index d0f034f6..0e6bcb45 100644 --- a/gpu/internal/convertshaders/hlsl.go +++ b/gpu/internal/convertshaders/hlsl.go @@ -78,7 +78,7 @@ type DXC struct { WorkDir WorkDir } -func NewDXC() *DXC { return &DXC{Bin: "dxc.exe"} } +func NewDXC() *DXC { return &DXC{Bin: "dxc"} } // Compile compiles the input shader. func (dxc *DXC) Compile(path, variant string, input []byte, entryPoint string, profile string) (string, error) { @@ -92,12 +92,6 @@ func (dxc *DXC) Compile(path, variant string, input []byte, entryPoint string, p } cmd := exec.Command(dxc.Bin) - if runtime.GOOS != "windows" { - cmd = exec.Command("wine", dxc.Bin) - if err := winepath(&pathin, &pathout); err != nil { - return "", err - } - } cmd.Args = append(cmd.Args, "-Fo", pathout, @@ -109,11 +103,7 @@ func (dxc *DXC) Compile(path, variant string, input []byte, entryPoint string, p output, err := cmd.CombinedOutput() if err != nil { - info := "" - if runtime.GOOS != "windows" { - info = "If the dxc tool cannot be found, set WINEPATH to the Windows path for the Windows SDK.\n" - } - return "", fmt.Errorf("%s\n%sfailed to run %v: %w", output, info, cmd.Args, err) + return "", fmt.Errorf("%s\nfailed to run %v: %w", output, cmd.Args, err) } compiled, err := ioutil.ReadFile(result) diff --git a/gpu/internal/convertshaders/main.go b/gpu/internal/convertshaders/main.go index a69f8fff..e55645ea 100644 --- a/gpu/internal/convertshaders/main.go +++ b/gpu/internal/convertshaders/main.go @@ -103,7 +103,10 @@ func NewConverter(workDir WorkDir, packageName, shadersDir string, directCompute verifyBinaryPath(&conv.glslvalidator.Bin) verifyBinaryPath(&conv.spirv.Bin) - // we cannot check fxc/dxc, since they may depend on wine + if directCompute { + verifyBinaryPath(&conv.dxc.Bin) + } + // We cannot check fxc since it may depend on wine. conv.glslvalidator.WorkDir = workDir.Dir("glslvalidator") conv.fxc.WorkDir = workDir.Dir("fxc")