gpu/internal/convertshaders: don't use Wine for the dxc tool

dxc exists for Linux, and seems to work.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-04-10 12:23:30 +02:00
parent 23e0c898ef
commit 3b3d41a7ea
2 changed files with 6 additions and 13 deletions
+2 -12
View File
@@ -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)
+4 -1
View File
@@ -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")