ホーム › Graphics.Direct3D.Fxc › D3DReflect
D3DReflect
関数シェーダーバイトコードのリフレクション情報を取得する。
シグネチャ
// D3DCOMPILER_47.dll
#include <windows.h>
HRESULT D3DReflect(
const void* pSrcData,
UINT_PTR SrcDataSize,
const GUID* pInterface,
void** ppReflector
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pSrcData | void* | in |
| SrcDataSize | UINT_PTR | in |
| pInterface | GUID* | in |
| ppReflector | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// D3DCOMPILER_47.dll
#include <windows.h>
HRESULT D3DReflect(
const void* pSrcData,
UINT_PTR SrcDataSize,
const GUID* pInterface,
void** ppReflector
);[DllImport("D3DCOMPILER_47.dll", ExactSpelling = true)]
static extern int D3DReflect(
IntPtr pSrcData, // void*
UIntPtr SrcDataSize, // UINT_PTR
ref Guid pInterface, // GUID*
IntPtr ppReflector // void** out
);<DllImport("D3DCOMPILER_47.dll", ExactSpelling:=True)>
Public Shared Function D3DReflect(
pSrcData As IntPtr, ' void*
SrcDataSize As UIntPtr, ' UINT_PTR
ByRef pInterface As Guid, ' GUID*
ppReflector As IntPtr ' void** out
) As Integer
End Function' pSrcData : void*
' SrcDataSize : UINT_PTR
' pInterface : GUID*
' ppReflector : void** out
Declare PtrSafe Function D3DReflect Lib "d3dcompiler_47" ( _
ByVal pSrcData As LongPtr, _
ByVal SrcDataSize As LongPtr, _
ByVal pInterface As LongPtr, _
ByVal ppReflector As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3DReflect = ctypes.windll.d3dcompiler_47.D3DReflect
D3DReflect.restype = ctypes.c_int
D3DReflect.argtypes = [
ctypes.POINTER(None), # pSrcData : void*
ctypes.c_size_t, # SrcDataSize : UINT_PTR
ctypes.c_void_p, # pInterface : GUID*
ctypes.c_void_p, # ppReflector : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('D3DCOMPILER_47.dll')
D3DReflect = Fiddle::Function.new(
lib['D3DReflect'],
[
Fiddle::TYPE_VOIDP, # pSrcData : void*
Fiddle::TYPE_UINTPTR_T, # SrcDataSize : UINT_PTR
Fiddle::TYPE_VOIDP, # pInterface : GUID*
Fiddle::TYPE_VOIDP, # ppReflector : void** out
],
Fiddle::TYPE_INT)#[link(name = "d3dcompiler_47")]
extern "system" {
fn D3DReflect(
pSrcData: *const (), // void*
SrcDataSize: usize, // UINT_PTR
pInterface: *const GUID, // GUID*
ppReflector: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("D3DCOMPILER_47.dll")]
public static extern int D3DReflect(IntPtr pSrcData, UIntPtr SrcDataSize, ref Guid pInterface, IntPtr ppReflector);
"@
$api = Add-Type -MemberDefinition $sig -Name 'D3DCOMPILER_47_D3DReflect' -Namespace Win32 -PassThru
# $api::D3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector)#uselib "D3DCOMPILER_47.dll"
#func global D3DReflect "D3DReflect" sptr, sptr, sptr, sptr
; D3DReflect pSrcData, SrcDataSize, varptr(pInterface), ppReflector ; 戻り値は stat
; pSrcData : void* -> "sptr"
; SrcDataSize : UINT_PTR -> "sptr"
; pInterface : GUID* -> "sptr"
; ppReflector : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "D3DCOMPILER_47.dll" #cfunc global D3DReflect "D3DReflect" sptr, sptr, var, sptr ; res = D3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector) ; pSrcData : void* -> "sptr" ; SrcDataSize : UINT_PTR -> "sptr" ; pInterface : GUID* -> "var" ; ppReflector : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "D3DCOMPILER_47.dll" #cfunc global D3DReflect "D3DReflect" sptr, sptr, sptr, sptr ; res = D3DReflect(pSrcData, SrcDataSize, varptr(pInterface), ppReflector) ; pSrcData : void* -> "sptr" ; SrcDataSize : UINT_PTR -> "sptr" ; pInterface : GUID* -> "sptr" ; ppReflector : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT D3DReflect(void* pSrcData, UINT_PTR SrcDataSize, GUID* pInterface, void** ppReflector) #uselib "D3DCOMPILER_47.dll" #cfunc global D3DReflect "D3DReflect" intptr, intptr, var, intptr ; res = D3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector) ; pSrcData : void* -> "intptr" ; SrcDataSize : UINT_PTR -> "intptr" ; pInterface : GUID* -> "var" ; ppReflector : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT D3DReflect(void* pSrcData, UINT_PTR SrcDataSize, GUID* pInterface, void** ppReflector) #uselib "D3DCOMPILER_47.dll" #cfunc global D3DReflect "D3DReflect" intptr, intptr, intptr, intptr ; res = D3DReflect(pSrcData, SrcDataSize, varptr(pInterface), ppReflector) ; pSrcData : void* -> "intptr" ; SrcDataSize : UINT_PTR -> "intptr" ; pInterface : GUID* -> "intptr" ; ppReflector : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3dcompiler_47 = windows.NewLazySystemDLL("D3DCOMPILER_47.dll")
procD3DReflect = d3dcompiler_47.NewProc("D3DReflect")
)
// pSrcData (void*), SrcDataSize (UINT_PTR), pInterface (GUID*), ppReflector (void** out)
r1, _, err := procD3DReflect.Call(
uintptr(pSrcData),
uintptr(SrcDataSize),
uintptr(pInterface),
uintptr(ppReflector),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3DReflect(
pSrcData: Pointer; // void*
SrcDataSize: NativeUInt; // UINT_PTR
pInterface: PGUID; // GUID*
ppReflector: Pointer // void** out
): Integer; stdcall;
external 'D3DCOMPILER_47.dll' name 'D3DReflect';result := DllCall("D3DCOMPILER_47\D3DReflect"
, "Ptr", pSrcData ; void*
, "UPtr", SrcDataSize ; UINT_PTR
, "Ptr", pInterface ; GUID*
, "Ptr", ppReflector ; void** out
, "Int") ; return: HRESULT●D3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector) = DLL("D3DCOMPILER_47.dll", "int D3DReflect(void*, int, void*, void*)")
# 呼び出し: D3DReflect(pSrcData, SrcDataSize, pInterface, ppReflector)
# pSrcData : void* -> "void*"
# SrcDataSize : UINT_PTR -> "int"
# pInterface : GUID* -> "void*"
# ppReflector : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。