Win32 API 日本語リファレンス
ホームGraphics.Direct3D11 › D3D11_INPUT_ELEMENT_DESC

D3D11_INPUT_ELEMENT_DESC

構造体
サイズx64: 32 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
SemanticNameLPSTR8/4+0+0入力要素のセマンティック名を示す文字列。シェーダ入力と対応付ける。
SemanticIndexDWORD4+8+4同名セマンティックを区別するゼロ起点のインデックス。
FormatDXGI_FORMAT4+12+8入力要素のデータフォーマット(DXGI_FORMAT)。
InputSlotDWORD4+16+12この要素を供給する入力アセンブラのスロット番号(0〜15)。
AlignedByteOffsetDWORD4+20+16頂点先頭からの要素オフセット。D3D11_APPEND_ALIGNED_ELEMENTで自動算出。
InputSlotClassD3D11_INPUT_CLASSIFICATION4+24+20頂点単位か(インスタンス単位)かのデータ分類を示す列挙値。
InstanceDataStepRateDWORD4+28+24インスタンスデータを次へ進める前の描画インスタンス数。頂点単位では0。

各言語での定義

#include <windows.h>

// D3D11_INPUT_ELEMENT_DESC  (x64 32 / x86 28 バイト)
typedef struct D3D11_INPUT_ELEMENT_DESC {
    LPSTR SemanticName;
    DWORD SemanticIndex;
    DXGI_FORMAT Format;
    DWORD InputSlot;
    DWORD AlignedByteOffset;
    D3D11_INPUT_CLASSIFICATION InputSlotClass;
    DWORD InstanceDataStepRate;
} D3D11_INPUT_ELEMENT_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_INPUT_ELEMENT_DESC
{
    public IntPtr SemanticName;
    public uint SemanticIndex;
    public int Format;
    public uint InputSlot;
    public uint AlignedByteOffset;
    public int InputSlotClass;
    public uint InstanceDataStepRate;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_INPUT_ELEMENT_DESC
    Public SemanticName As IntPtr
    Public SemanticIndex As UInteger
    Public Format As Integer
    Public InputSlot As UInteger
    Public AlignedByteOffset As UInteger
    Public InputSlotClass As Integer
    Public InstanceDataStepRate As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3D11_INPUT_ELEMENT_DESC(ctypes.Structure):
    _fields_ = [
        ("SemanticName", ctypes.c_void_p),
        ("SemanticIndex", wintypes.DWORD),
        ("Format", ctypes.c_int),
        ("InputSlot", wintypes.DWORD),
        ("AlignedByteOffset", wintypes.DWORD),
        ("InputSlotClass", ctypes.c_int),
        ("InstanceDataStepRate", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3D11_INPUT_ELEMENT_DESC {
    pub SemanticName: *mut core::ffi::c_void,
    pub SemanticIndex: u32,
    pub Format: i32,
    pub InputSlot: u32,
    pub AlignedByteOffset: u32,
    pub InputSlotClass: i32,
    pub InstanceDataStepRate: u32,
}
import "golang.org/x/sys/windows"

type D3D11_INPUT_ELEMENT_DESC struct {
	SemanticName uintptr
	SemanticIndex uint32
	Format int32
	InputSlot uint32
	AlignedByteOffset uint32
	InputSlotClass int32
	InstanceDataStepRate uint32
}
type
  D3D11_INPUT_ELEMENT_DESC = record
    SemanticName: Pointer;
    SemanticIndex: DWORD;
    Format: Integer;
    InputSlot: DWORD;
    AlignedByteOffset: DWORD;
    InputSlotClass: Integer;
    InstanceDataStepRate: DWORD;
  end;
const D3D11_INPUT_ELEMENT_DESC = extern struct {
    SemanticName: ?*anyopaque,
    SemanticIndex: u32,
    Format: i32,
    InputSlot: u32,
    AlignedByteOffset: u32,
    InputSlotClass: i32,
    InstanceDataStepRate: u32,
};
type
  D3D11_INPUT_ELEMENT_DESC {.bycopy.} = object
    SemanticName: pointer
    SemanticIndex: uint32
    Format: int32
    InputSlot: uint32
    AlignedByteOffset: uint32
    InputSlotClass: int32
    InstanceDataStepRate: uint32
struct D3D11_INPUT_ELEMENT_DESC
{
    void* SemanticName;
    uint SemanticIndex;
    int Format;
    uint InputSlot;
    uint AlignedByteOffset;
    int InputSlotClass;
    uint InstanceDataStepRate;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D11_INPUT_ELEMENT_DESC サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; SemanticName : LPSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SemanticIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Format : DXGI_FORMAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; InputSlot : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; AlignedByteOffset : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; InputSlotClass : D3D11_INPUT_CLASSIFICATION (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; InstanceDataStepRate : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D11_INPUT_ELEMENT_DESC サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; SemanticName : LPSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; SemanticIndex : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Format : DXGI_FORMAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; InputSlot : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; AlignedByteOffset : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; InputSlotClass : D3D11_INPUT_CLASSIFICATION (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; InstanceDataStepRate : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D11_INPUT_ELEMENT_DESC
    #field intptr SemanticName
    #field int SemanticIndex
    #field int Format
    #field int InputSlot
    #field int AlignedByteOffset
    #field int InputSlotClass
    #field int InstanceDataStepRate
#endstruct

stdim st, D3D11_INPUT_ELEMENT_DESC        ; NSTRUCT 変数を確保
st->SemanticIndex = 100
mes "SemanticIndex=" + st->SemanticIndex