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

D3D10_SO_DECLARATION_ENTRY

構造体
サイズx64: 16 バイト / x86: 12 バイト

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

フィールド

フィールドサイズx64x86説明
SemanticNameLPSTR8/4+0+0ストリーム出力先となる頂点要素のセマンティック名を指す文字列。NULL指定でその要素を出力から除外する。
SemanticIndexDWORD4+8+4同名セマンティックを区別するゼロ起点のインデックス。複数要素を持つセマンティックで使う。
StartComponentBYTE1+12+8書き込み開始するコンポーネント番号。0=x,1=y,2=z,3=w を表す。
ComponentCountBYTE1+13+9出力するコンポーネント数。1〜4の範囲で指定する。
OutputSlotBYTE1+14+10書き込み先のストリーム出力バッファスロット番号。0〜3の範囲で指定する。

各言語での定義

#include <windows.h>

// D3D10_SO_DECLARATION_ENTRY  (x64 16 / x86 12 バイト)
typedef struct D3D10_SO_DECLARATION_ENTRY {
    LPSTR SemanticName;
    DWORD SemanticIndex;
    BYTE StartComponent;
    BYTE ComponentCount;
    BYTE OutputSlot;
} D3D10_SO_DECLARATION_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D10_SO_DECLARATION_ENTRY
{
    public IntPtr SemanticName;
    public uint SemanticIndex;
    public byte StartComponent;
    public byte ComponentCount;
    public byte OutputSlot;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D10_SO_DECLARATION_ENTRY
    Public SemanticName As IntPtr
    Public SemanticIndex As UInteger
    Public StartComponent As Byte
    Public ComponentCount As Byte
    Public OutputSlot As Byte
End Structure
import ctypes
from ctypes import wintypes

class D3D10_SO_DECLARATION_ENTRY(ctypes.Structure):
    _fields_ = [
        ("SemanticName", ctypes.c_void_p),
        ("SemanticIndex", wintypes.DWORD),
        ("StartComponent", ctypes.c_ubyte),
        ("ComponentCount", ctypes.c_ubyte),
        ("OutputSlot", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct D3D10_SO_DECLARATION_ENTRY {
    pub SemanticName: *mut core::ffi::c_void,
    pub SemanticIndex: u32,
    pub StartComponent: u8,
    pub ComponentCount: u8,
    pub OutputSlot: u8,
}
import "golang.org/x/sys/windows"

type D3D10_SO_DECLARATION_ENTRY struct {
	SemanticName uintptr
	SemanticIndex uint32
	StartComponent byte
	ComponentCount byte
	OutputSlot byte
}
type
  D3D10_SO_DECLARATION_ENTRY = record
    SemanticName: Pointer;
    SemanticIndex: DWORD;
    StartComponent: Byte;
    ComponentCount: Byte;
    OutputSlot: Byte;
  end;
const D3D10_SO_DECLARATION_ENTRY = extern struct {
    SemanticName: ?*anyopaque,
    SemanticIndex: u32,
    StartComponent: u8,
    ComponentCount: u8,
    OutputSlot: u8,
};
type
  D3D10_SO_DECLARATION_ENTRY {.bycopy.} = object
    SemanticName: pointer
    SemanticIndex: uint32
    StartComponent: uint8
    ComponentCount: uint8
    OutputSlot: uint8
struct D3D10_SO_DECLARATION_ENTRY
{
    void* SemanticName;
    uint SemanticIndex;
    ubyte StartComponent;
    ubyte ComponentCount;
    ubyte OutputSlot;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D10_SO_DECLARATION_ENTRY サイズ: 12 バイト(x86)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; SemanticName : LPSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SemanticIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; StartComponent : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; ComponentCount : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; OutputSlot : BYTE (+10, 1byte)  poke st,10,値  /  値 = peek(st,10)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D10_SO_DECLARATION_ENTRY サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 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 も可)
; StartComponent : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; ComponentCount : BYTE (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; OutputSlot : BYTE (+14, 1byte)  poke st,14,値  /  値 = peek(st,14)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D10_SO_DECLARATION_ENTRY
    #field intptr SemanticName
    #field int SemanticIndex
    #field byte StartComponent
    #field byte ComponentCount
    #field byte OutputSlot
#endstruct

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