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

D3DDEVINFO_RESOURCEMANAGER

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

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

フィールド

フィールドサイズx64x86説明
statsD3DRESOURCESTATS352+0+0リソース種別ごとの統計情報配列(D3DRESOURCESTATS)。

各言語での定義

#include <windows.h>

// D3DRESOURCESTATS  (x64 44 / x86 44 バイト)
typedef struct D3DRESOURCESTATS {
    BOOL bThrashing;
    DWORD ApproxBytesDownloaded;
    DWORD NumEvicts;
    DWORD NumVidCreates;
    DWORD LastPri;
    DWORD NumUsed;
    DWORD NumUsedInVidMem;
    DWORD WorkingSet;
    DWORD WorkingSetBytes;
    DWORD TotalManaged;
    DWORD TotalBytes;
} D3DRESOURCESTATS;

// D3DDEVINFO_RESOURCEMANAGER  (x64 352 / x86 352 バイト)
typedef struct D3DDEVINFO_RESOURCEMANAGER {
    D3DRESOURCESTATS stats[8];
} D3DDEVINFO_RESOURCEMANAGER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DRESOURCESTATS
{
    [MarshalAs(UnmanagedType.Bool)] public bool bThrashing;
    public uint ApproxBytesDownloaded;
    public uint NumEvicts;
    public uint NumVidCreates;
    public uint LastPri;
    public uint NumUsed;
    public uint NumUsedInVidMem;
    public uint WorkingSet;
    public uint WorkingSetBytes;
    public uint TotalManaged;
    public uint TotalBytes;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DDEVINFO_RESOURCEMANAGER
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public D3DRESOURCESTATS[] stats;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DRESOURCESTATS
    <MarshalAs(UnmanagedType.Bool)> Public bThrashing As Boolean
    Public ApproxBytesDownloaded As UInteger
    Public NumEvicts As UInteger
    Public NumVidCreates As UInteger
    Public LastPri As UInteger
    Public NumUsed As UInteger
    Public NumUsedInVidMem As UInteger
    Public WorkingSet As UInteger
    Public WorkingSetBytes As UInteger
    Public TotalManaged As UInteger
    Public TotalBytes As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DDEVINFO_RESOURCEMANAGER
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public stats() As D3DRESOURCESTATS
End Structure
import ctypes
from ctypes import wintypes

class D3DRESOURCESTATS(ctypes.Structure):
    _fields_ = [
        ("bThrashing", wintypes.BOOL),
        ("ApproxBytesDownloaded", wintypes.DWORD),
        ("NumEvicts", wintypes.DWORD),
        ("NumVidCreates", wintypes.DWORD),
        ("LastPri", wintypes.DWORD),
        ("NumUsed", wintypes.DWORD),
        ("NumUsedInVidMem", wintypes.DWORD),
        ("WorkingSet", wintypes.DWORD),
        ("WorkingSetBytes", wintypes.DWORD),
        ("TotalManaged", wintypes.DWORD),
        ("TotalBytes", wintypes.DWORD),
    ]

class D3DDEVINFO_RESOURCEMANAGER(ctypes.Structure):
    _fields_ = [
        ("stats", D3DRESOURCESTATS * 8),
    ]
#[repr(C)]
pub struct D3DRESOURCESTATS {
    pub bThrashing: i32,
    pub ApproxBytesDownloaded: u32,
    pub NumEvicts: u32,
    pub NumVidCreates: u32,
    pub LastPri: u32,
    pub NumUsed: u32,
    pub NumUsedInVidMem: u32,
    pub WorkingSet: u32,
    pub WorkingSetBytes: u32,
    pub TotalManaged: u32,
    pub TotalBytes: u32,
}

#[repr(C)]
pub struct D3DDEVINFO_RESOURCEMANAGER {
    pub stats: [D3DRESOURCESTATS; 8],
}
import "golang.org/x/sys/windows"

type D3DRESOURCESTATS struct {
	bThrashing int32
	ApproxBytesDownloaded uint32
	NumEvicts uint32
	NumVidCreates uint32
	LastPri uint32
	NumUsed uint32
	NumUsedInVidMem uint32
	WorkingSet uint32
	WorkingSetBytes uint32
	TotalManaged uint32
	TotalBytes uint32
}

type D3DDEVINFO_RESOURCEMANAGER struct {
	stats [8]D3DRESOURCESTATS
}
type
  D3DRESOURCESTATS = record
    bThrashing: BOOL;
    ApproxBytesDownloaded: DWORD;
    NumEvicts: DWORD;
    NumVidCreates: DWORD;
    LastPri: DWORD;
    NumUsed: DWORD;
    NumUsedInVidMem: DWORD;
    WorkingSet: DWORD;
    WorkingSetBytes: DWORD;
    TotalManaged: DWORD;
    TotalBytes: DWORD;
  end;

  D3DDEVINFO_RESOURCEMANAGER = record
    stats: array[0..7] of D3DRESOURCESTATS;
  end;
const D3DRESOURCESTATS = extern struct {
    bThrashing: i32,
    ApproxBytesDownloaded: u32,
    NumEvicts: u32,
    NumVidCreates: u32,
    LastPri: u32,
    NumUsed: u32,
    NumUsedInVidMem: u32,
    WorkingSet: u32,
    WorkingSetBytes: u32,
    TotalManaged: u32,
    TotalBytes: u32,
};

const D3DDEVINFO_RESOURCEMANAGER = extern struct {
    stats: [8]D3DRESOURCESTATS,
};
type
  D3DRESOURCESTATS {.bycopy.} = object
    bThrashing: int32
    ApproxBytesDownloaded: uint32
    NumEvicts: uint32
    NumVidCreates: uint32
    LastPri: uint32
    NumUsed: uint32
    NumUsedInVidMem: uint32
    WorkingSet: uint32
    WorkingSetBytes: uint32
    TotalManaged: uint32
    TotalBytes: uint32

  D3DDEVINFO_RESOURCEMANAGER {.bycopy.} = object
    stats: array[8, D3DRESOURCESTATS]
struct D3DRESOURCESTATS
{
    int bThrashing;
    uint ApproxBytesDownloaded;
    uint NumEvicts;
    uint NumVidCreates;
    uint LastPri;
    uint NumUsed;
    uint NumUsedInVidMem;
    uint WorkingSet;
    uint WorkingSetBytes;
    uint TotalManaged;
    uint TotalBytes;
}

struct D3DDEVINFO_RESOURCEMANAGER
{
    D3DRESOURCESTATS[8] stats;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DDEVINFO_RESOURCEMANAGER サイズ: 352 バイト(x64)
dim st, 88    ; 4byte整数×88(構造体サイズ 352 / 4 切り上げ)
; stats : D3DRESOURCESTATS (+0, 352byte)  varptr(st)+0 を基点に操作(352byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3DRESOURCESTATS
    #field bool bThrashing
    #field int ApproxBytesDownloaded
    #field int NumEvicts
    #field int NumVidCreates
    #field int LastPri
    #field int NumUsed
    #field int NumUsedInVidMem
    #field int WorkingSet
    #field int WorkingSetBytes
    #field int TotalManaged
    #field int TotalBytes
#endstruct

#defstruct global D3DDEVINFO_RESOURCEMANAGER
    #field D3DRESOURCESTATS stats 8
#endstruct

stdim st, D3DDEVINFO_RESOURCEMANAGER        ; NSTRUCT 変数を確保