ホーム › Graphics.Direct3D12 › D3D12GetDebugInterface
D3D12GetDebugInterface
関数Direct3D12のデバッグ用インターフェースを取得する。
シグネチャ
// d3d12.dll
#include <windows.h>
HRESULT D3D12GetDebugInterface(
const GUID* riid,
void** ppvDebug // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| riid | GUID* | in | 要求するデバッグインターフェイス(ID3D12Debug等)のIID。 |
| ppvDebug | void** | outoptional | 取得したデバッグインターフェイスを受け取る出力先。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// d3d12.dll
#include <windows.h>
HRESULT D3D12GetDebugInterface(
const GUID* riid,
void** ppvDebug // optional
);[DllImport("d3d12.dll", ExactSpelling = true)]
static extern int D3D12GetDebugInterface(
ref Guid riid, // GUID*
IntPtr ppvDebug // void** optional, out
);<DllImport("d3d12.dll", ExactSpelling:=True)>
Public Shared Function D3D12GetDebugInterface(
ByRef riid As Guid, ' GUID*
ppvDebug As IntPtr ' void** optional, out
) As Integer
End Function' riid : GUID*
' ppvDebug : void** optional, out
Declare PtrSafe Function D3D12GetDebugInterface Lib "d3d12" ( _
ByVal riid As LongPtr, _
ByVal ppvDebug As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3D12GetDebugInterface = ctypes.windll.d3d12.D3D12GetDebugInterface
D3D12GetDebugInterface.restype = ctypes.c_int
D3D12GetDebugInterface.argtypes = [
ctypes.c_void_p, # riid : GUID*
ctypes.c_void_p, # ppvDebug : void** optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('d3d12.dll')
D3D12GetDebugInterface = Fiddle::Function.new(
lib['D3D12GetDebugInterface'],
[
Fiddle::TYPE_VOIDP, # riid : GUID*
Fiddle::TYPE_VOIDP, # ppvDebug : void** optional, out
],
Fiddle::TYPE_INT)#[link(name = "d3d12")]
extern "system" {
fn D3D12GetDebugInterface(
riid: *const GUID, // GUID*
ppvDebug: *mut *mut () // void** optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("d3d12.dll")]
public static extern int D3D12GetDebugInterface(ref Guid riid, IntPtr ppvDebug);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d12_D3D12GetDebugInterface' -Namespace Win32 -PassThru
# $api::D3D12GetDebugInterface(riid, ppvDebug)#uselib "d3d12.dll"
#func global D3D12GetDebugInterface "D3D12GetDebugInterface" sptr, sptr
; D3D12GetDebugInterface varptr(riid), ppvDebug ; 戻り値は stat
; riid : GUID* -> "sptr"
; ppvDebug : void** optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "d3d12.dll" #cfunc global D3D12GetDebugInterface "D3D12GetDebugInterface" var, sptr ; res = D3D12GetDebugInterface(riid, ppvDebug) ; riid : GUID* -> "var" ; ppvDebug : void** optional, out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "d3d12.dll" #cfunc global D3D12GetDebugInterface "D3D12GetDebugInterface" sptr, sptr ; res = D3D12GetDebugInterface(varptr(riid), ppvDebug) ; riid : GUID* -> "sptr" ; ppvDebug : void** optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT D3D12GetDebugInterface(GUID* riid, void** ppvDebug) #uselib "d3d12.dll" #cfunc global D3D12GetDebugInterface "D3D12GetDebugInterface" var, intptr ; res = D3D12GetDebugInterface(riid, ppvDebug) ; riid : GUID* -> "var" ; ppvDebug : void** optional, out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT D3D12GetDebugInterface(GUID* riid, void** ppvDebug) #uselib "d3d12.dll" #cfunc global D3D12GetDebugInterface "D3D12GetDebugInterface" intptr, intptr ; res = D3D12GetDebugInterface(varptr(riid), ppvDebug) ; riid : GUID* -> "intptr" ; ppvDebug : void** optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3d12 = windows.NewLazySystemDLL("d3d12.dll")
procD3D12GetDebugInterface = d3d12.NewProc("D3D12GetDebugInterface")
)
// riid (GUID*), ppvDebug (void** optional, out)
r1, _, err := procD3D12GetDebugInterface.Call(
uintptr(riid),
uintptr(ppvDebug),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3D12GetDebugInterface(
riid: PGUID; // GUID*
ppvDebug: Pointer // void** optional, out
): Integer; stdcall;
external 'd3d12.dll' name 'D3D12GetDebugInterface';result := DllCall("d3d12\D3D12GetDebugInterface"
, "Ptr", riid ; GUID*
, "Ptr", ppvDebug ; void** optional, out
, "Int") ; return: HRESULT●D3D12GetDebugInterface(riid, ppvDebug) = DLL("d3d12.dll", "int D3D12GetDebugInterface(void*, void*)")
# 呼び出し: D3D12GetDebugInterface(riid, ppvDebug)
# riid : GUID* -> "void*"
# ppvDebug : void** optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "d3d12" fn D3D12GetDebugInterface(
riid: [*c]GUID, // GUID*
ppvDebug: ?*anyopaque // void** optional, out
) callconv(std.os.windows.WINAPI) i32;proc D3D12GetDebugInterface(
riid: ptr GUID, # GUID*
ppvDebug: pointer # void** optional, out
): int32 {.importc: "D3D12GetDebugInterface", stdcall, dynlib: "d3d12.dll".}pragma(lib, "d3d12");
extern(Windows)
int D3D12GetDebugInterface(
GUID* riid, // GUID*
void** ppvDebug // void** optional, out
);ccall((:D3D12GetDebugInterface, "d3d12.dll"), stdcall, Int32,
(Ptr{GUID}, Ptr{Cvoid}),
riid, ppvDebug)
# riid : GUID* -> Ptr{GUID}
# ppvDebug : void** optional, out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t D3D12GetDebugInterface(
void* riid,
void** ppvDebug);
]]
local d3d12 = ffi.load("d3d12")
-- d3d12.D3D12GetDebugInterface(riid, ppvDebug)
-- riid : GUID*
-- ppvDebug : void** optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('d3d12.dll');
const D3D12GetDebugInterface = lib.func('__stdcall', 'D3D12GetDebugInterface', 'int32_t', ['void *', 'void *']);
// D3D12GetDebugInterface(riid, ppvDebug)
// riid : GUID* -> 'void *'
// ppvDebug : void** optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("d3d12.dll", {
D3D12GetDebugInterface: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.D3D12GetDebugInterface(riid, ppvDebug)
// riid : GUID* -> "pointer"
// ppvDebug : void** optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t D3D12GetDebugInterface(
void* riid,
void** ppvDebug);
C, "d3d12.dll");
// $ffi->D3D12GetDebugInterface(riid, ppvDebug);
// riid : GUID*
// ppvDebug : void** optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface D3d12 extends StdCallLibrary {
D3d12 INSTANCE = Native.load("d3d12", D3d12.class);
int D3D12GetDebugInterface(
Pointer riid, // GUID*
Pointer ppvDebug // void** optional, out
);
}@[Link("d3d12")]
lib Libd3d12
fun D3D12GetDebugInterface = D3D12GetDebugInterface(
riid : GUID*, # GUID*
ppvDebug : Void** # void** optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef D3D12GetDebugInterfaceNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef D3D12GetDebugInterfaceDart = int Function(Pointer<Void>, Pointer<Void>);
final D3D12GetDebugInterface = DynamicLibrary.open('d3d12.dll')
.lookupFunction<D3D12GetDebugInterfaceNative, D3D12GetDebugInterfaceDart>('D3D12GetDebugInterface');
// riid : GUID* -> Pointer<Void>
// ppvDebug : void** optional, out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function D3D12GetDebugInterface(
riid: PGUID; // GUID*
ppvDebug: Pointer // void** optional, out
): Integer; stdcall;
external 'd3d12.dll' name 'D3D12GetDebugInterface';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "D3D12GetDebugInterface"
c_D3D12GetDebugInterface :: Ptr () -> Ptr () -> IO Int32
-- riid : GUID* -> Ptr ()
-- ppvDebug : void** optional, out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let d3d12getdebuginterface =
foreign "D3D12GetDebugInterface"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* riid : GUID* -> (ptr void) *)
(* ppvDebug : void** optional, out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library d3d12 (t "d3d12.dll"))
(cffi:use-foreign-library d3d12)
(cffi:defcfun ("D3D12GetDebugInterface" d3-d12-get-debug-interface :convention :stdcall) :int32
(riid :pointer) ; GUID*
(ppv-debug :pointer)) ; void** optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $D3D12GetDebugInterface = Win32::API::More->new('d3d12',
'int D3D12GetDebugInterface(LPVOID riid, LPVOID ppvDebug)');
# my $ret = $D3D12GetDebugInterface->Call($riid, $ppvDebug);
# riid : GUID* -> LPVOID
# ppvDebug : void** optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。