ホーム › Graphics.Direct3D9 › D3DPERF_BeginEvent
D3DPERF_BeginEvent
関数プロファイラ用に名前付きイベント区間の開始をマークする。
シグネチャ
// d3d9.dll
#include <windows.h>
INT D3DPERF_BeginEvent(
DWORD col,
LPCWSTR wszName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| col | DWORD | in |
| wszName | LPCWSTR | in |
戻り値の型: INT
各言語での呼び出し定義
// d3d9.dll
#include <windows.h>
INT D3DPERF_BeginEvent(
DWORD col,
LPCWSTR wszName
);[DllImport("d3d9.dll", ExactSpelling = true)]
static extern int D3DPERF_BeginEvent(
uint col, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string wszName // LPCWSTR
);<DllImport("d3d9.dll", ExactSpelling:=True)>
Public Shared Function D3DPERF_BeginEvent(
col As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> wszName As String ' LPCWSTR
) As Integer
End Function' col : DWORD
' wszName : LPCWSTR
Declare PtrSafe Function D3DPERF_BeginEvent Lib "d3d9" ( _
ByVal col As Long, _
ByVal wszName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3DPERF_BeginEvent = ctypes.windll.d3d9.D3DPERF_BeginEvent
D3DPERF_BeginEvent.restype = ctypes.c_int
D3DPERF_BeginEvent.argtypes = [
wintypes.DWORD, # col : DWORD
wintypes.LPCWSTR, # wszName : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('d3d9.dll')
D3DPERF_BeginEvent = Fiddle::Function.new(
lib['D3DPERF_BeginEvent'],
[
-Fiddle::TYPE_INT, # col : DWORD
Fiddle::TYPE_VOIDP, # wszName : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "d3d9")]
extern "system" {
fn D3DPERF_BeginEvent(
col: u32, // DWORD
wszName: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("d3d9.dll")]
public static extern int D3DPERF_BeginEvent(uint col, [MarshalAs(UnmanagedType.LPWStr)] string wszName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d9_D3DPERF_BeginEvent' -Namespace Win32 -PassThru
# $api::D3DPERF_BeginEvent(col, wszName)#uselib "d3d9.dll"
#func global D3DPERF_BeginEvent "D3DPERF_BeginEvent" sptr, sptr
; D3DPERF_BeginEvent col, wszName ; 戻り値は stat
; col : DWORD -> "sptr"
; wszName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "d3d9.dll"
#cfunc global D3DPERF_BeginEvent "D3DPERF_BeginEvent" int, wstr
; res = D3DPERF_BeginEvent(col, wszName)
; col : DWORD -> "int"
; wszName : LPCWSTR -> "wstr"; INT D3DPERF_BeginEvent(DWORD col, LPCWSTR wszName)
#uselib "d3d9.dll"
#cfunc global D3DPERF_BeginEvent "D3DPERF_BeginEvent" int, wstr
; res = D3DPERF_BeginEvent(col, wszName)
; col : DWORD -> "int"
; wszName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3d9 = windows.NewLazySystemDLL("d3d9.dll")
procD3DPERF_BeginEvent = d3d9.NewProc("D3DPERF_BeginEvent")
)
// col (DWORD), wszName (LPCWSTR)
r1, _, err := procD3DPERF_BeginEvent.Call(
uintptr(col),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wszName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction D3DPERF_BeginEvent(
col: DWORD; // DWORD
wszName: PWideChar // LPCWSTR
): Integer; stdcall;
external 'd3d9.dll' name 'D3DPERF_BeginEvent';result := DllCall("d3d9\D3DPERF_BeginEvent"
, "UInt", col ; DWORD
, "WStr", wszName ; LPCWSTR
, "Int") ; return: INT●D3DPERF_BeginEvent(col, wszName) = DLL("d3d9.dll", "int D3DPERF_BeginEvent(dword, char*)")
# 呼び出し: D3DPERF_BeginEvent(col, wszName)
# col : DWORD -> "dword"
# wszName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。