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シェーダーの入力シグネチャ内で、この要素に関連付けられた HLSL セマンティクスです。詳細については、HLSL セマンティクスを参照してください。
SemanticIndexDWORD4+8+4

要素のセマンティック インデックスです。セマンティック インデックスは、整数のインデックス番号によってセマンティクスを修飾します。セマンティック インデックスが必要になるのは、同じセマンティクスを持つ要素が複数存在する場合だけです。たとえば 4x4 の行列は 4 つの成分を持ち、それぞれが

matrix

というセマンティック名を持ちますが、4 つの成分はそれぞれ異なるセマンティック インデックス (0、1、2、3) を持ちます。

FormatDXGI_FORMAT4+12+8要素データのデータ型です。DXGI_FORMAT を参照してください。
InputSlotDWORD4+16+12入力アセンブラーを識別する整数値です (入力スロットを参照)。有効な値は 0 から 15 の範囲で、D3D11.h で定義されています。
AlignedByteOffsetDWORD4+20+16省略可能です。頂点の先頭からのオフセット (バイト単位) です。D3D11_APPEND_ALIGNED_ELEMENT を使用すると、必要に応じたパッキングも含めて、現在の要素を直前の要素の直後に配置するよう簡便に定義できます。
InputSlotClassD3D11_INPUT_CLASSIFICATION4+24+20単一の入力スロットに対する入力データ クラスを識別します (D3D11_INPUT_CLASSIFICATION を参照)。
InstanceDataStepRateDWORD4+28+24バッファー内で要素を 1 つ進める前に、同じインスタンス単位のデータを使用して描画するインスタンスの数です。頂点単位のデータを含む要素 (スロット クラスが D3D11_INPUT_PER_VERTEX_DATA に設定されている要素) では、この値は 0 でなければなりません。

公式ドキュメント

入力アセンブラー ステージの単一の要素を記述します。

解説(Remarks)

入力レイアウト オブジェクトは構造体の配列を保持し、各構造体は入力スロットから読み取られる 1 つの要素を定義します。入力レイアウト オブジェクトは ID3D11Device::CreateInputLayout を呼び出して作成します。例については、入力アセンブラー ステージの概要のトピックにある「Create the Input-Layout Object」のサブトピックを参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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