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

D3D11_CLASS_INSTANCE_DESC

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

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

フィールド

フィールドサイズx64x86説明
InstanceIdDWORD4+0+0クラスインスタンスを識別するID。
InstanceIndexDWORD4+4+4クラスインスタンスのインデックス。
TypeIdDWORD4+8+8クラスの型を識別するID。
ConstantBufferDWORD4+12+12このインスタンスが使用する定数バッファのインデックス。
BaseConstantBufferOffsetDWORD4+16+16定数バッファ内のベースオフセット。
BaseTextureDWORD4+20+20このインスタンスのベーステクスチャスロット番号。
BaseSamplerDWORD4+24+24このインスタンスのベースサンプラスロット番号。
CreatedBOOL4+28+28インスタンスが生成済みかどうか。TRUEなら生成済み。

各言語での定義

#include <windows.h>

// D3D11_CLASS_INSTANCE_DESC  (x64 32 / x86 32 バイト)
typedef struct D3D11_CLASS_INSTANCE_DESC {
    DWORD InstanceId;
    DWORD InstanceIndex;
    DWORD TypeId;
    DWORD ConstantBuffer;
    DWORD BaseConstantBufferOffset;
    DWORD BaseTexture;
    DWORD BaseSampler;
    BOOL Created;
} D3D11_CLASS_INSTANCE_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_CLASS_INSTANCE_DESC
{
    public uint InstanceId;
    public uint InstanceIndex;
    public uint TypeId;
    public uint ConstantBuffer;
    public uint BaseConstantBufferOffset;
    public uint BaseTexture;
    public uint BaseSampler;
    [MarshalAs(UnmanagedType.Bool)] public bool Created;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_CLASS_INSTANCE_DESC
    Public InstanceId As UInteger
    Public InstanceIndex As UInteger
    Public TypeId As UInteger
    Public ConstantBuffer As UInteger
    Public BaseConstantBufferOffset As UInteger
    Public BaseTexture As UInteger
    Public BaseSampler As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public Created As Boolean
End Structure
import ctypes
from ctypes import wintypes

class D3D11_CLASS_INSTANCE_DESC(ctypes.Structure):
    _fields_ = [
        ("InstanceId", wintypes.DWORD),
        ("InstanceIndex", wintypes.DWORD),
        ("TypeId", wintypes.DWORD),
        ("ConstantBuffer", wintypes.DWORD),
        ("BaseConstantBufferOffset", wintypes.DWORD),
        ("BaseTexture", wintypes.DWORD),
        ("BaseSampler", wintypes.DWORD),
        ("Created", wintypes.BOOL),
    ]
#[repr(C)]
pub struct D3D11_CLASS_INSTANCE_DESC {
    pub InstanceId: u32,
    pub InstanceIndex: u32,
    pub TypeId: u32,
    pub ConstantBuffer: u32,
    pub BaseConstantBufferOffset: u32,
    pub BaseTexture: u32,
    pub BaseSampler: u32,
    pub Created: i32,
}
import "golang.org/x/sys/windows"

type D3D11_CLASS_INSTANCE_DESC struct {
	InstanceId uint32
	InstanceIndex uint32
	TypeId uint32
	ConstantBuffer uint32
	BaseConstantBufferOffset uint32
	BaseTexture uint32
	BaseSampler uint32
	Created int32
}
type
  D3D11_CLASS_INSTANCE_DESC = record
    InstanceId: DWORD;
    InstanceIndex: DWORD;
    TypeId: DWORD;
    ConstantBuffer: DWORD;
    BaseConstantBufferOffset: DWORD;
    BaseTexture: DWORD;
    BaseSampler: DWORD;
    Created: BOOL;
  end;
const D3D11_CLASS_INSTANCE_DESC = extern struct {
    InstanceId: u32,
    InstanceIndex: u32,
    TypeId: u32,
    ConstantBuffer: u32,
    BaseConstantBufferOffset: u32,
    BaseTexture: u32,
    BaseSampler: u32,
    Created: i32,
};
type
  D3D11_CLASS_INSTANCE_DESC {.bycopy.} = object
    InstanceId: uint32
    InstanceIndex: uint32
    TypeId: uint32
    ConstantBuffer: uint32
    BaseConstantBufferOffset: uint32
    BaseTexture: uint32
    BaseSampler: uint32
    Created: int32
struct D3D11_CLASS_INSTANCE_DESC
{
    uint InstanceId;
    uint InstanceIndex;
    uint TypeId;
    uint ConstantBuffer;
    uint BaseConstantBufferOffset;
    uint BaseTexture;
    uint BaseSampler;
    int Created;
}

HSP用 定義

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

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

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