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

DXGI_FRAME_STATISTICS_MEDIA

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

サイズ=各フィールドのバイト数(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時刻フィールド。
CompositionModeDXGI_FRAME_PRESENTATION_MODE4+32+32メディアフレームの合成(プレゼンテーション)モードを示す列挙値。
ApprovedPresentDurationDWORD4+36+36承認されたPresentの表示継続時間(100ナノ秒単位)。

各言語での定義

#include <windows.h>

// DXGI_FRAME_STATISTICS_MEDIA  (x64 40 / x86 40 バイト)
typedef struct DXGI_FRAME_STATISTICS_MEDIA {
    DWORD PresentCount;
    DWORD PresentRefreshCount;
    DWORD SyncRefreshCount;
    LONGLONG SyncQPCTime;
    LONGLONG SyncGPUTime;
    DXGI_FRAME_PRESENTATION_MODE CompositionMode;
    DWORD ApprovedPresentDuration;
} DXGI_FRAME_STATISTICS_MEDIA;
using System;
using System.Runtime.InteropServices;

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

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

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

type DXGI_FRAME_STATISTICS_MEDIA struct {
	PresentCount uint32
	PresentRefreshCount uint32
	SyncRefreshCount uint32
	SyncQPCTime int64
	SyncGPUTime int64
	CompositionMode int32
	ApprovedPresentDuration uint32
}
type
  DXGI_FRAME_STATISTICS_MEDIA = record
    PresentCount: DWORD;
    PresentRefreshCount: DWORD;
    SyncRefreshCount: DWORD;
    SyncQPCTime: Int64;
    SyncGPUTime: Int64;
    CompositionMode: Integer;
    ApprovedPresentDuration: DWORD;
  end;
const DXGI_FRAME_STATISTICS_MEDIA = extern struct {
    PresentCount: u32,
    PresentRefreshCount: u32,
    SyncRefreshCount: u32,
    SyncQPCTime: i64,
    SyncGPUTime: i64,
    CompositionMode: i32,
    ApprovedPresentDuration: u32,
};
type
  DXGI_FRAME_STATISTICS_MEDIA {.bycopy.} = object
    PresentCount: uint32
    PresentRefreshCount: uint32
    SyncRefreshCount: uint32
    SyncQPCTime: int64
    SyncGPUTime: int64
    CompositionMode: int32
    ApprovedPresentDuration: uint32
struct DXGI_FRAME_STATISTICS_MEDIA
{
    uint PresentCount;
    uint PresentRefreshCount;
    uint SyncRefreshCount;
    long SyncQPCTime;
    long SyncGPUTime;
    int CompositionMode;
    uint ApprovedPresentDuration;
}

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_MEDIA サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 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,上位
; CompositionMode : DXGI_FRAME_PRESENTATION_MODE (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ApprovedPresentDuration : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DXGI_FRAME_STATISTICS_MEDIA
    #field int PresentCount
    #field int PresentRefreshCount
    #field int SyncRefreshCount
    #field int64 SyncQPCTime
    #field int64 SyncGPUTime
    #field int CompositionMode
    #field int ApprovedPresentDuration
#endstruct

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