diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index e5db41fc1..aa0617532 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -44,43 +44,6 @@ func NewGraphics() (graphicsdriver.Graphics, error) { return g, nil } -var inputElementDescs []_D3D12_INPUT_ELEMENT_DESC - -func init() { - position := []byte("POSITION\000") - texcoord := []byte("TEXCOORD\000") - color := []byte("COLOR\000") - inputElementDescs = []_D3D12_INPUT_ELEMENT_DESC{ - { - SemanticName: &position[0], - SemanticIndex: 0, - Format: _DXGI_FORMAT_R32G32_FLOAT, - InputSlot: 0, - AlignedByteOffset: _D3D12_APPEND_ALIGNED_ELEMENT, - InputSlotClass: _D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, - InstanceDataStepRate: 0, - }, - { - SemanticName: &texcoord[0], - SemanticIndex: 0, - Format: _DXGI_FORMAT_R32G32_FLOAT, - InputSlot: 0, - AlignedByteOffset: _D3D12_APPEND_ALIGNED_ELEMENT, - InputSlotClass: _D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, - InstanceDataStepRate: 0, - }, - { - SemanticName: &color[0], - SemanticIndex: 0, - Format: _DXGI_FORMAT_R32G32B32A32_FLOAT, - InputSlot: 0, - AlignedByteOffset: _D3D12_APPEND_ALIGNED_ELEMENT, - InputSlotClass: _D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, - InstanceDataStepRate: 0, - }, - } -} - type resourceWithSize struct { value *_ID3D12Resource sizeInBytes uint32 diff --git a/internal/graphicsdriver/directx/pipeline_windows.go b/internal/graphicsdriver/directx/pipeline_windows.go index 9527e7c17..275e55b5e 100644 --- a/internal/graphicsdriver/directx/pipeline_windows.go +++ b/internal/graphicsdriver/directx/pipeline_windows.go @@ -25,6 +25,36 @@ import ( "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver" ) +var inputElementDescs = []_D3D12_INPUT_ELEMENT_DESC{ + { + SemanticName: &([]byte("POSITION\000"))[0], + SemanticIndex: 0, + Format: _DXGI_FORMAT_R32G32_FLOAT, + InputSlot: 0, + AlignedByteOffset: _D3D12_APPEND_ALIGNED_ELEMENT, + InputSlotClass: _D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, + InstanceDataStepRate: 0, + }, + { + SemanticName: &([]byte("TEXCOORD\000"))[0], + SemanticIndex: 0, + Format: _DXGI_FORMAT_R32G32_FLOAT, + InputSlot: 0, + AlignedByteOffset: _D3D12_APPEND_ALIGNED_ELEMENT, + InputSlotClass: _D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, + InstanceDataStepRate: 0, + }, + { + SemanticName: &([]byte("COLOR\000"))[0], + SemanticIndex: 0, + Format: _DXGI_FORMAT_R32G32B32A32_FLOAT, + InputSlot: 0, + AlignedByteOffset: _D3D12_APPEND_ALIGNED_ELEMENT, + InputSlotClass: _D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, + InstanceDataStepRate: 0, + }, +} + const numDescriptorsPerFrame = 32 func blendFactorToBlend(f graphicsdriver.BlendFactor, alpha bool) _D3D12_BLEND {