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

D3DINDEXBUFFER_DESC

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

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

フィールド

フィールドサイズx64x86説明
FormatD3DFORMAT4+0+0インデックスの形式を示すD3DFORMAT(16/32ビット)。
TypeD3DRESOURCETYPE4+4+4リソース種別を示すD3DRESOURCETYPE(インデックスバッファ)。
UsageDWORD4+8+8バッファの使用法を制御するフラグ群。
PoolD3DPOOL4+12+12メモリプールの種別を示すD3DPOOL。
SizeDWORD4+16+16バッファのサイズ(バイト単位)。

各言語での定義

#include <windows.h>

// D3DINDEXBUFFER_DESC  (x64 20 / x86 20 バイト)
typedef struct D3DINDEXBUFFER_DESC {
    D3DFORMAT Format;
    D3DRESOURCETYPE Type;
    DWORD Usage;
    D3DPOOL Pool;
    DWORD Size;
} D3DINDEXBUFFER_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DINDEXBUFFER_DESC
{
    public uint Format;
    public int Type;
    public uint Usage;
    public int Pool;
    public uint Size;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DINDEXBUFFER_DESC
    Public Format As UInteger
    Public Type As Integer
    Public Usage As UInteger
    Public Pool As Integer
    Public Size As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3DINDEXBUFFER_DESC(ctypes.Structure):
    _fields_ = [
        ("Format", wintypes.DWORD),
        ("Type", ctypes.c_int),
        ("Usage", wintypes.DWORD),
        ("Pool", ctypes.c_int),
        ("Size", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3DINDEXBUFFER_DESC {
    pub Format: u32,
    pub Type: i32,
    pub Usage: u32,
    pub Pool: i32,
    pub Size: u32,
}
import "golang.org/x/sys/windows"

type D3DINDEXBUFFER_DESC struct {
	Format uint32
	Type int32
	Usage uint32
	Pool int32
	Size uint32
}
type
  D3DINDEXBUFFER_DESC = record
    Format: DWORD;
    Type: Integer;
    Usage: DWORD;
    Pool: Integer;
    Size: DWORD;
  end;
const D3DINDEXBUFFER_DESC = extern struct {
    Format: u32,
    Type: i32,
    Usage: u32,
    Pool: i32,
    Size: u32,
};
type
  D3DINDEXBUFFER_DESC {.bycopy.} = object
    Format: uint32
    Type: int32
    Usage: uint32
    Pool: int32
    Size: uint32
struct D3DINDEXBUFFER_DESC
{
    uint Format;
    int Type;
    uint Usage;
    int Pool;
    uint Size;
}

HSP用 定義

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

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

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