mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/graphicsdriver/directx: refactoring
This commit is contained in:
parent
3e0ff1abe1
commit
4ec27262ed
@ -44,43 +44,6 @@ func NewGraphics() (graphicsdriver.Graphics, error) {
|
|||||||
return g, nil
|
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 {
|
type resourceWithSize struct {
|
||||||
value *_ID3D12Resource
|
value *_ID3D12Resource
|
||||||
sizeInBytes uint32
|
sizeInBytes uint32
|
||||||
|
@ -25,6 +25,36 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
"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
|
const numDescriptorsPerFrame = 32
|
||||||
|
|
||||||
func blendFactorToBlend(f graphicsdriver.BlendFactor, alpha bool) _D3D12_BLEND {
|
func blendFactorToBlend(f graphicsdriver.BlendFactor, alpha bool) _D3D12_BLEND {
|
||||||
|
Loading…
Reference in New Issue
Block a user