Skip to content

Commit

Permalink
config: error on dxvk && no d3d renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Nov 2, 2023
1 parent e318b72 commit 9324a23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 1 addition & 4 deletions config/cardpick.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package config
import (
"errors"
"fmt"
"log"
"strconv"

"github.com/vinegarhq/vinegar/sysinfo"
Expand Down Expand Up @@ -36,7 +35,7 @@ func (b *Binary) pickCard() error {

// Check if the system actually has PRIME offload and there's no ambiguity with the GPUs.
if prime {
vk := (b.Dxvk && b.Renderer == "D3D11") || b.Renderer == "Vulkan"
vk := b.Dxvk || b.Renderer == "Vulkan"

if n != 2 && (!vk && n != 1) {
return fmt.Errorf("opengl is not capable of choosing the right gpu, it must be explicitly defined")
Expand All @@ -59,8 +58,6 @@ func (b *Binary) pickCard() error {
return errors.New("gpu not found")
}

log.Printf("Using Card index: %d", idx)

b.Env.Set("MESA_VK_DEVICE_SELECT_FORCE_DEFAULT_DEVICE", "1")
b.Env.Set("DRI_PRIME", strconv.Itoa(idx))

Expand Down
13 changes: 9 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"os"
"path/filepath"
"strings"

"dario.cat/mergo"
"github.com/BurntSushi/toml"
Expand Down Expand Up @@ -83,24 +84,24 @@ func Default() Config {
DxvkVersion: "2.3",

Global: Binary{
ForcedGpu: "prime-discrete",
ForcedGpu: "prime-discrete",
Dxvk: true,
AutoKillPrefix: true,
Env: Environment{
"WINEARCH": "win64",
"WINEDEBUG": "err-kerberos,err-ntlm",
"WINEESYNC": "1",
"WINEDLLOVERRIDES": "dxdiagn,winemenubuilder.exe,mscoree,mshtml=",

"DXVK_LOG_LEVEL": "warn",
"DXVK_LOG_PATH": "none",

"MESA_GL_VERSION_OVERRIDE": "4.4",
"__GL_THREADED_OPTIMIZATIONS": "1",
},
},
Player: Binary{
DiscordRPC: true,
DiscordRPC: true,
FFlags: roblox.FFlags{
"DFIntTaskSchedulerTargetFps": 640,
},
Expand All @@ -127,6 +128,10 @@ func (b *Binary) setup() error {
return err
}

if !strings.HasPrefix(b.Renderer, "D3D11") && b.Dxvk {
return errors.New("dxvk is only valid with d3d renderers")
}

b.Env.Setenv()
return nil
}
Expand Down

0 comments on commit 9324a23

Please sign in to comment.