mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
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:
@@ -78,7 +78,7 @@ type DXC struct {
|
|||||||
WorkDir WorkDir
|
WorkDir WorkDir
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDXC() *DXC { return &DXC{Bin: "dxc.exe"} }
|
func NewDXC() *DXC { return &DXC{Bin: "dxc"} }
|
||||||
|
|
||||||
// Compile compiles the input shader.
|
// Compile compiles the input shader.
|
||||||
func (dxc *DXC) Compile(path, variant string, input []byte, entryPoint string, profile string) (string, error) {
|
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)
|
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,
|
cmd.Args = append(cmd.Args,
|
||||||
"-Fo", pathout,
|
"-Fo", pathout,
|
||||||
@@ -109,11 +103,7 @@ func (dxc *DXC) Compile(path, variant string, input []byte, entryPoint string, p
|
|||||||
|
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
info := ""
|
return "", fmt.Errorf("%s\nfailed to run %v: %w", output, cmd.Args, err)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compiled, err := ioutil.ReadFile(result)
|
compiled, err := ioutil.ReadFile(result)
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ func NewConverter(workDir WorkDir, packageName, shadersDir string, directCompute
|
|||||||
|
|
||||||
verifyBinaryPath(&conv.glslvalidator.Bin)
|
verifyBinaryPath(&conv.glslvalidator.Bin)
|
||||||
verifyBinaryPath(&conv.spirv.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.glslvalidator.WorkDir = workDir.Dir("glslvalidator")
|
||||||
conv.fxc.WorkDir = workDir.Dir("fxc")
|
conv.fxc.WorkDir = workDir.Dir("fxc")
|
||||||
|
|||||||
Reference in New Issue
Block a user