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

D3DPRESENTSTATS

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

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

フィールド

フィールドサイズx64x86説明
PresentCountDWORD4+0+0Present呼び出しの累積回数。
PresentRefreshCountDWORD4+4+4Presentが行われたリフレッシュのカウント。
SyncRefreshCountDWORD4+8+8同期が取れたリフレッシュのカウント。
SyncQPCTimeLONGLONG8+12+12同期時の高精度パフォーマンスカウンタ値(64ビット)。
SyncGPUTimeLONGLONG8+20+20同期時のGPUタイム値(64ビット)。

各言語での定義

#include <windows.h>

// D3DPRESENTSTATS  (x64 28 / x86 28 バイト)
#pragma pack(push, 4)
typedef struct D3DPRESENTSTATS {
    DWORD PresentCount;
    DWORD PresentRefreshCount;
    DWORD SyncRefreshCount;
    LONGLONG SyncQPCTime;
    LONGLONG SyncGPUTime;
} D3DPRESENTSTATS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct D3DPRESENTSTATS
{
    public uint PresentCount;
    public uint PresentRefreshCount;
    public uint SyncRefreshCount;
    public long SyncQPCTime;
    public long SyncGPUTime;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure D3DPRESENTSTATS
    Public PresentCount As UInteger
    Public PresentRefreshCount As UInteger
    Public SyncRefreshCount As UInteger
    Public SyncQPCTime As Long
    Public SyncGPUTime As Long
End Structure
import ctypes
from ctypes import wintypes

class D3DPRESENTSTATS(ctypes.Structure):
    _pack_ = 4
    _fields_ = [
        ("PresentCount", wintypes.DWORD),
        ("PresentRefreshCount", wintypes.DWORD),
        ("SyncRefreshCount", wintypes.DWORD),
        ("SyncQPCTime", ctypes.c_longlong),
        ("SyncGPUTime", ctypes.c_longlong),
    ]
#[repr(C, packed(4))]
pub struct D3DPRESENTSTATS {
    pub PresentCount: u32,
    pub PresentRefreshCount: u32,
    pub SyncRefreshCount: u32,
    pub SyncQPCTime: i64,
    pub SyncGPUTime: i64,
}
import "golang.org/x/sys/windows"

type D3DPRESENTSTATS struct {
	PresentCount uint32
	PresentRefreshCount uint32
	SyncRefreshCount uint32
	SyncQPCTime int64
	SyncGPUTime int64
}
type
  D3DPRESENTSTATS = packed record
    PresentCount: DWORD;
    PresentRefreshCount: DWORD;
    SyncRefreshCount: DWORD;
    SyncQPCTime: Int64;
    SyncGPUTime: Int64;
  end;
const D3DPRESENTSTATS = extern struct {
    PresentCount: u32,
    PresentRefreshCount: u32,
    SyncRefreshCount: u32,
    SyncQPCTime: i64,
    SyncGPUTime: i64,
};
type
  D3DPRESENTSTATS {.packed.} = object
    PresentCount: uint32
    PresentRefreshCount: uint32
    SyncRefreshCount: uint32
    SyncQPCTime: int64
    SyncGPUTime: int64
align(4)
struct D3DPRESENTSTATS
{
    uint PresentCount;
    uint PresentRefreshCount;
    uint SyncRefreshCount;
    long SyncQPCTime;
    long SyncGPUTime;
}

HSP用 定義

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

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

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