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

D3DRESOURCESTATS

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

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

フィールド

フィールドサイズx64x86説明
bThrashingBOOL4+0+0リソースのスラッシングが発生しているかを示すBOOL。
ApproxBytesDownloadedDWORD4+4+4ダウンロードされた概算バイト数。
NumEvictsDWORD4+8+8退避されたリソースの回数。
NumVidCreatesDWORD4+12+12ビデオメモリ上で作成された回数。
LastPriDWORD4+16+16最後に設定された優先度。
NumUsedDWORD4+20+20使用されたリソース数。
NumUsedInVidMemDWORD4+24+24ビデオメモリ内で使用されたリソース数。
WorkingSetDWORD4+28+28ワーキングセット内のリソース数。
WorkingSetBytesDWORD4+32+32ワーキングセットのバイト数。
TotalManagedDWORD4+36+36管理対象リソースの総数。
TotalBytesDWORD4+40+40管理対象リソースの総バイト数。

各言語での定義

#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;
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;
}
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
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),
    ]
#[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,
}
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
  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;
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,
};
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
struct D3DRESOURCESTATS
{
    int bThrashing;
    uint ApproxBytesDownloaded;
    uint NumEvicts;
    uint NumVidCreates;
    uint LastPri;
    uint NumUsed;
    uint NumUsedInVidMem;
    uint WorkingSet;
    uint WorkingSetBytes;
    uint TotalManaged;
    uint TotalBytes;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DRESOURCESTATS サイズ: 44 バイト(x64)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; bThrashing : BOOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ApproxBytesDownloaded : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; NumEvicts : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; NumVidCreates : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; LastPri : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; NumUsed : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; NumUsedInVidMem : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; WorkingSet : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; WorkingSetBytes : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; TotalManaged : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; TotalBytes : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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

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