internal/graphicsdriver/directx: fix a constant value for Xbox

Updates #2084
This commit is contained in:
Hajime Hoshi 2022-06-13 14:20:43 +09:00
parent 44cfb92cee
commit 348435f769
2 changed files with 27 additions and 8 deletions

View File

@ -367,15 +367,34 @@ const (
type _D3D12_RESOURCE_STATES int32
const (
_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_GENERIC_READ _D3D12_RESOURCE_STATES = 0x1 | 0x2 | 0x40 | 0x80 | 0x200 | 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 (

View File

@ -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
}