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

DXGI_FRAME_STATISTICS

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

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

フィールド

フィールドサイズx64x86説明
PresentCountDWORD4+0+0アプリが呼び出したPresentの累積回数。
PresentRefreshCountDWORD4+4+4Present時点のリフレッシュ累積回数。
SyncRefreshCountDWORD4+8+8QPC時刻取得時のリフレッシュ累積回数。
SyncQPCTimeLONGLONG8+16+16直近のVBlankに対応する高精度カウンタ(QPC)時刻。
SyncGPUTimeLONGLONG8+24+24予約済みで通常0が返るGPU時刻フィールド。

各言語での定義

#include <windows.h>

// DXGI_FRAME_STATISTICS  (x64 32 / x86 32 バイト)
typedef struct DXGI_FRAME_STATISTICS {
    DWORD PresentCount;
    DWORD PresentRefreshCount;
    DWORD SyncRefreshCount;
    LONGLONG SyncQPCTime;
    LONGLONG SyncGPUTime;
} DXGI_FRAME_STATISTICS;
using System;
using System.Runtime.InteropServices;

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_FRAME_STATISTICS
    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 DXGI_FRAME_STATISTICS(ctypes.Structure):
    _fields_ = [
        ("PresentCount", wintypes.DWORD),
        ("PresentRefreshCount", wintypes.DWORD),
        ("SyncRefreshCount", wintypes.DWORD),
        ("SyncQPCTime", ctypes.c_longlong),
        ("SyncGPUTime", ctypes.c_longlong),
    ]
#[repr(C)]
pub struct DXGI_FRAME_STATISTICS {
    pub PresentCount: u32,
    pub PresentRefreshCount: u32,
    pub SyncRefreshCount: u32,
    pub SyncQPCTime: i64,
    pub SyncGPUTime: i64,
}
import "golang.org/x/sys/windows"

type DXGI_FRAME_STATISTICS struct {
	PresentCount uint32
	PresentRefreshCount uint32
	SyncRefreshCount uint32
	SyncQPCTime int64
	SyncGPUTime int64
}
type
  DXGI_FRAME_STATISTICS = record
    PresentCount: DWORD;
    PresentRefreshCount: DWORD;
    SyncRefreshCount: DWORD;
    SyncQPCTime: Int64;
    SyncGPUTime: Int64;
  end;
const DXGI_FRAME_STATISTICS = extern struct {
    PresentCount: u32,
    PresentRefreshCount: u32,
    SyncRefreshCount: u32,
    SyncQPCTime: i64,
    SyncGPUTime: i64,
};
type
  DXGI_FRAME_STATISTICS {.bycopy.} = object
    PresentCount: uint32
    PresentRefreshCount: uint32
    SyncRefreshCount: uint32
    SyncQPCTime: int64
    SyncGPUTime: int64
struct DXGI_FRAME_STATISTICS
{
    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 レイアウト)
; DXGI_FRAME_STATISTICS サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 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 (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; SyncGPUTime : LONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DXGI_FRAME_STATISTICS
    #field int PresentCount
    #field int PresentRefreshCount
    #field int SyncRefreshCount
    #field int64 SyncQPCTime
    #field int64 SyncGPUTime
#endstruct

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