internal/graphicsdriver/directx: bug fix: wrong SDK version for Xbox One

This commit is contained in:
Hajime Hoshi 2022-11-05 02:31:28 +09:00
parent 50021ef3e4
commit a6e121613f
4 changed files with 16 additions and 4 deletions

View File

@ -62,9 +62,6 @@ const (
_D3D12_MIN_DEPTH = 0.0 _D3D12_MIN_DEPTH = 0.0
_D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION = 16384 _D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION = 16384
_D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff _D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff
_D3D12_SDK_VERSION = (_D3D12_SDK_VERSION_MAJOR << 16) | _D3D12_SDK_VERSION_MINOR
_D3D12_SDK_VERSION_MAJOR = 2
_D3D12_SDK_VERSION_MINOR = 4
_D3D12XBOX_DEFAULT_SIZE_BYTES = 0xffffffff _D3D12XBOX_DEFAULT_SIZE_BYTES = 0xffffffff
) )

View File

@ -303,7 +303,7 @@ func (g *Graphics) initializeXbox(useWARP bool, useDebugLayer bool) (ferr error)
} }
params := &_D3D12XBOX_CREATE_DEVICE_PARAMETERS{ params := &_D3D12XBOX_CREATE_DEVICE_PARAMETERS{
Version: _D3D12_SDK_VERSION, // TODO: Can we always use the same value? Version: microsoftgdk.D3D12SDKVersion(),
GraphicsCommandQueueRingSizeBytes: _D3D12XBOX_DEFAULT_SIZE_BYTES, GraphicsCommandQueueRingSizeBytes: _D3D12XBOX_DEFAULT_SIZE_BYTES,
GraphicsScratchMemorySizeBytes: _D3D12XBOX_DEFAULT_SIZE_BYTES, GraphicsScratchMemorySizeBytes: _D3D12XBOX_DEFAULT_SIZE_BYTES,
ComputeScratchMemorySizeBytes: _D3D12XBOX_DEFAULT_SIZE_BYTES, ComputeScratchMemorySizeBytes: _D3D12XBOX_DEFAULT_SIZE_BYTES,

View File

@ -87,6 +87,17 @@ func D3D12DLLName() string {
} }
} }
func D3D12SDKVersion() uint32 {
switch C.XSystemGetDeviceType() {
case _XSystemDeviceType_XboxOne, _XSystemDeviceType_XboxOneS, _XSystemDeviceType_XboxOneX, _XSystemDeviceType_XboxOneXDevkit:
return (1 << 16) | 10
case _XSystemDeviceType_XboxScarlettLockhart, _XSystemDeviceType_XboxScarlettAnaconda, _XSystemDeviceType_XboxScarlettDevkit:
return (2 << 16) | 4
default:
return 0
}
}
func init() { func init() {
if r := C.XGameRuntimeInitialize(); uint32(r) != uint32(windows.S_OK) { if r := C.XGameRuntimeInitialize(); uint32(r) != uint32(windows.S_OK) {
panic(fmt.Sprintf("microsoftgdk: XSystemGetDeviceType failed: HRESULT(%d)", uint32(r))) panic(fmt.Sprintf("microsoftgdk: XSystemGetDeviceType failed: HRESULT(%d)", uint32(r)))

View File

@ -27,3 +27,7 @@ func MonitorResolution() (int, int) {
func D3D12DLLName() string { func D3D12DLLName() string {
return "" return ""
} }
func D3D12SDKVersion() uint32 {
return 0
}