internal/microsoftgdk: improve forward compatibility

This commit is contained in:
Hajime Hoshi 2022-12-25 21:57:26 +09:00
parent 8b588587cc
commit 0c072894b5

View File

@ -63,6 +63,8 @@ func IsXbox() bool {
func MonitorResolution() (int, int) {
switch C.XSystemGetDeviceType() {
case _XSystemDeviceType_Unknown, _XSystemDeviceType_Pc:
return 1920, 1080
case _XSystemDeviceType_XboxOne, _XSystemDeviceType_XboxOneS:
return 1920, 1080
case _XSystemDeviceType_XboxScarlettLockhart:
@ -70,31 +72,38 @@ func MonitorResolution() (int, int) {
return 2560, 1440
case _XSystemDeviceType_XboxOneX, _XSystemDeviceType_XboxOneXDevkit, _XSystemDeviceType_XboxScarlettAnaconda, _XSystemDeviceType_XboxScarlettDevkit:
// Series X
return 3840, 2160
fallthrough
default:
return 1920, 1080
// Forward compatibility.
return 3840, 2160
}
}
func D3D12DLLName() string {
switch C.XSystemGetDeviceType() {
case _XSystemDeviceType_Unknown, _XSystemDeviceType_Pc:
return ""
case _XSystemDeviceType_XboxOne, _XSystemDeviceType_XboxOneS, _XSystemDeviceType_XboxOneX, _XSystemDeviceType_XboxOneXDevkit:
return "d3d12_x.dll"
case _XSystemDeviceType_XboxScarlettLockhart, _XSystemDeviceType_XboxScarlettAnaconda, _XSystemDeviceType_XboxScarlettDevkit:
return "d3d12_xs.dll"
fallthrough
default:
return ""
// Forward compatibility.
return "d3d12_xs.dll"
}
}
func D3D12SDKVersion() uint32 {
switch C.XSystemGetDeviceType() {
case _XSystemDeviceType_Unknown, _XSystemDeviceType_Pc:
return 0
case _XSystemDeviceType_XboxOne, _XSystemDeviceType_XboxOneS, _XSystemDeviceType_XboxOneX, _XSystemDeviceType_XboxOneXDevkit:
return (1 << 16) | 10
case _XSystemDeviceType_XboxScarlettLockhart, _XSystemDeviceType_XboxScarlettAnaconda, _XSystemDeviceType_XboxScarlettDevkit:
return (2 << 16) | 4
fallthrough
default:
return 0
// Forward compatibility.
return (2 << 16) | 4
}
}