diff --git a/internal/graphicsdriver/directx/api_windows.go b/internal/graphicsdriver/directx/api_windows.go index 0a9e28b8d..92810bdd7 100644 --- a/internal/graphicsdriver/directx/api_windows.go +++ b/internal/graphicsdriver/directx/api_windows.go @@ -367,15 +367,34 @@ const ( type _D3D12_RESOURCE_STATES int32 const ( - _D3D12_RESOURCE_STATE_RENDER_TARGET _D3D12_RESOURCE_STATES = 0x4 - _D3D12_RESOURCE_STATE_DEPTH_WRITE _D3D12_RESOURCE_STATES = 0x10 - _D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE _D3D12_RESOURCE_STATES = 0x80 - _D3D12_RESOURCE_STATE_COPY_DEST _D3D12_RESOURCE_STATES = 0x400 - _D3D12_RESOURCE_STATE_COPY_SOURCE _D3D12_RESOURCE_STATES = 0x800 - _D3D12_RESOURCE_STATE_GENERIC_READ _D3D12_RESOURCE_STATES = 0x1 | 0x2 | 0x40 | 0x80 | 0x200 | 0x800 - _D3D12_RESOURCE_STATE_PRESENT _D3D12_RESOURCE_STATES = 0 + _D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER _D3D12_RESOURCE_STATES = 0x1 + _D3D12_RESOURCE_STATE_INDEX_BUFFER _D3D12_RESOURCE_STATES = 0x2 + _D3D12_RESOURCE_STATE_RENDER_TARGET _D3D12_RESOURCE_STATES = 0x4 + _D3D12_RESOURCE_STATE_DEPTH_WRITE _D3D12_RESOURCE_STATES = 0x10 + _D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE _D3D12_RESOURCE_STATES = 0x40 + _D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE _D3D12_RESOURCE_STATES = 0x80 + _D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT _D3D12_RESOURCE_STATES = 0x200 + _D3D12_RESOURCE_STATE_COPY_DEST _D3D12_RESOURCE_STATES = 0x400 + _D3D12_RESOURCE_STATE_COPY_SOURCE _D3D12_RESOURCE_STATES = 0x800 + _D3D12_RESOURCE_STATE_PRESENT _D3D12_RESOURCE_STATES = 0 ) +func _D3D12_RESOURCE_STATE_GENERIC_READ() _D3D12_RESOURCE_STATES { + if microsoftgdk.IsXbox() { + return _D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER | + _D3D12_RESOURCE_STATE_INDEX_BUFFER | + _D3D12_RESOURCE_STATE_COPY_SOURCE | + _D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | + _D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE + } + return _D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER | + _D3D12_RESOURCE_STATE_INDEX_BUFFER | + _D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE | + _D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE | + _D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT | + _D3D12_RESOURCE_STATE_COPY_SOURCE +} + type _D3D12_ROOT_PARAMETER_TYPE int32 const ( diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index 41a1bd0d4..42c937338 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -424,7 +424,7 @@ func (g *Graphics) Initialize() (ferr error) { } func createBuffer(device *_ID3D12Device, bufferSize uint64, heapType _D3D12_HEAP_TYPE) (*_ID3D12Resource, error) { - state := _D3D12_RESOURCE_STATE_GENERIC_READ + state := _D3D12_RESOURCE_STATE_GENERIC_READ() if heapType == _D3D12_HEAP_TYPE_READBACK { state = _D3D12_RESOURCE_STATE_COPY_DEST }