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

D3DMEMORYPRESSURE

構造体
サイズx64: 20 バイト / x86: 20 バイトパッキング4

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

フィールド

フィールドサイズx64x86説明
BytesEvictedFromProcessULONGLONG8+0+0プロセスから退避されたメモリのバイト数(64ビット)。
SizeOfInefficientAllocationULONGLONG8+8+8非効率な割り当てのサイズ(バイト単位)。
LevelOfEfficiencyDWORD4+16+16メモリ効率のレベルを示す値。

各言語での定義

#include <windows.h>

// D3DMEMORYPRESSURE  (x64 20 / x86 20 バイト)
#pragma pack(push, 4)
typedef struct D3DMEMORYPRESSURE {
    ULONGLONG BytesEvictedFromProcess;
    ULONGLONG SizeOfInefficientAllocation;
    DWORD LevelOfEfficiency;
} D3DMEMORYPRESSURE;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct D3DMEMORYPRESSURE
{
    public ulong BytesEvictedFromProcess;
    public ulong SizeOfInefficientAllocation;
    public uint LevelOfEfficiency;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure D3DMEMORYPRESSURE
    Public BytesEvictedFromProcess As ULong
    Public SizeOfInefficientAllocation As ULong
    Public LevelOfEfficiency As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3DMEMORYPRESSURE(ctypes.Structure):
    _pack_ = 4
    _fields_ = [
        ("BytesEvictedFromProcess", ctypes.c_ulonglong),
        ("SizeOfInefficientAllocation", ctypes.c_ulonglong),
        ("LevelOfEfficiency", wintypes.DWORD),
    ]
#[repr(C, packed(4))]
pub struct D3DMEMORYPRESSURE {
    pub BytesEvictedFromProcess: u64,
    pub SizeOfInefficientAllocation: u64,
    pub LevelOfEfficiency: u32,
}
import "golang.org/x/sys/windows"

type D3DMEMORYPRESSURE struct {
	BytesEvictedFromProcess uint64
	SizeOfInefficientAllocation uint64
	LevelOfEfficiency uint32
}
type
  D3DMEMORYPRESSURE = packed record
    BytesEvictedFromProcess: UInt64;
    SizeOfInefficientAllocation: UInt64;
    LevelOfEfficiency: DWORD;
  end;
const D3DMEMORYPRESSURE = extern struct {
    BytesEvictedFromProcess: u64,
    SizeOfInefficientAllocation: u64,
    LevelOfEfficiency: u32,
};
type
  D3DMEMORYPRESSURE {.packed.} = object
    BytesEvictedFromProcess: uint64
    SizeOfInefficientAllocation: uint64
    LevelOfEfficiency: uint32
align(4)
struct D3DMEMORYPRESSURE
{
    ulong BytesEvictedFromProcess;
    ulong SizeOfInefficientAllocation;
    uint LevelOfEfficiency;
}

HSP用 定義

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

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

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