ホーム › Graphics.Direct3D10 › D3D10ReflectShader
D3D10ReflectShader
関数シェーダーバイトコードからリフレクションインターフェースを生成する。
シグネチャ
// d3d10.dll
#include <windows.h>
HRESULT D3D10ReflectShader(
const void* pShaderBytecode,
UINT_PTR BytecodeLength,
ID3D10ShaderReflection** ppReflector
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pShaderBytecode | void* | in |
| BytecodeLength | UINT_PTR | in |
| ppReflector | ID3D10ShaderReflection** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// d3d10.dll
#include <windows.h>
HRESULT D3D10ReflectShader(
const void* pShaderBytecode,
UINT_PTR BytecodeLength,
ID3D10ShaderReflection** ppReflector
);[DllImport("d3d10.dll", ExactSpelling = true)]
static extern int D3D10ReflectShader(
IntPtr pShaderBytecode, // void*
UIntPtr BytecodeLength, // UINT_PTR
IntPtr ppReflector // ID3D10ShaderReflection** out
);<DllImport("d3d10.dll", ExactSpelling:=True)>
Public Shared Function D3D10ReflectShader(
pShaderBytecode As IntPtr, ' void*
BytecodeLength As UIntPtr, ' UINT_PTR
ppReflector As IntPtr ' ID3D10ShaderReflection** out
) As Integer
End Function' pShaderBytecode : void*
' BytecodeLength : UINT_PTR
' ppReflector : ID3D10ShaderReflection** out
Declare PtrSafe Function D3D10ReflectShader Lib "d3d10" ( _
ByVal pShaderBytecode As LongPtr, _
ByVal BytecodeLength 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
D3D10ReflectShader = ctypes.windll.d3d10.D3D10ReflectShader
D3D10ReflectShader.restype = ctypes.c_int
D3D10ReflectShader.argtypes = [
ctypes.POINTER(None), # pShaderBytecode : void*
ctypes.c_size_t, # BytecodeLength : UINT_PTR
ctypes.c_void_p, # ppReflector : ID3D10ShaderReflection** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('d3d10.dll')
D3D10ReflectShader = Fiddle::Function.new(
lib['D3D10ReflectShader'],
[
Fiddle::TYPE_VOIDP, # pShaderBytecode : void*
Fiddle::TYPE_UINTPTR_T, # BytecodeLength : UINT_PTR
Fiddle::TYPE_VOIDP, # ppReflector : ID3D10ShaderReflection** out
],
Fiddle::TYPE_INT)#[link(name = "d3d10")]
extern "system" {
fn D3D10ReflectShader(
pShaderBytecode: *const (), // void*
BytecodeLength: usize, // UINT_PTR
ppReflector: *mut *mut core::ffi::c_void // ID3D10ShaderReflection** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("d3d10.dll")]
public static extern int D3D10ReflectShader(IntPtr pShaderBytecode, UIntPtr BytecodeLength, IntPtr ppReflector);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d10_D3D10ReflectShader' -Namespace Win32 -PassThru
# $api::D3D10ReflectShader(pShaderBytecode, BytecodeLength, ppReflector)#uselib "d3d10.dll"
#func global D3D10ReflectShader "D3D10ReflectShader" sptr, sptr, sptr
; D3D10ReflectShader pShaderBytecode, BytecodeLength, ppReflector ; 戻り値は stat
; pShaderBytecode : void* -> "sptr"
; BytecodeLength : UINT_PTR -> "sptr"
; ppReflector : ID3D10ShaderReflection** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "d3d10.dll"
#cfunc global D3D10ReflectShader "D3D10ReflectShader" sptr, sptr, sptr
; res = D3D10ReflectShader(pShaderBytecode, BytecodeLength, ppReflector)
; pShaderBytecode : void* -> "sptr"
; BytecodeLength : UINT_PTR -> "sptr"
; ppReflector : ID3D10ShaderReflection** out -> "sptr"; HRESULT D3D10ReflectShader(void* pShaderBytecode, UINT_PTR BytecodeLength, ID3D10ShaderReflection** ppReflector)
#uselib "d3d10.dll"
#cfunc global D3D10ReflectShader "D3D10ReflectShader" intptr, intptr, intptr
; res = D3D10ReflectShader(pShaderBytecode, BytecodeLength, ppReflector)
; pShaderBytecode : void* -> "intptr"
; BytecodeLength : UINT_PTR -> "intptr"
; ppReflector : ID3D10ShaderReflection** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3d10 = windows.NewLazySystemDLL("d3d10.dll")
procD3D10ReflectShader = d3d10.NewProc("D3D10ReflectShader")
)
// pShaderBytecode (void*), BytecodeLength (UINT_PTR), ppReflector (ID3D10ShaderReflection** out)
r1, _, err := procD3D10ReflectShader.Call(
uintptr(pShaderBytecode),
uintptr(BytecodeLength),
uintptr(ppReflector),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3D10ReflectShader(
pShaderBytecode: Pointer; // void*
BytecodeLength: NativeUInt; // UINT_PTR
ppReflector: Pointer // ID3D10ShaderReflection** out
): Integer; stdcall;
external 'd3d10.dll' name 'D3D10ReflectShader';result := DllCall("d3d10\D3D10ReflectShader"
, "Ptr", pShaderBytecode ; void*
, "UPtr", BytecodeLength ; UINT_PTR
, "Ptr", ppReflector ; ID3D10ShaderReflection** out
, "Int") ; return: HRESULT●D3D10ReflectShader(pShaderBytecode, BytecodeLength, ppReflector) = DLL("d3d10.dll", "int D3D10ReflectShader(void*, int, void*)")
# 呼び出し: D3D10ReflectShader(pShaderBytecode, BytecodeLength, ppReflector)
# pShaderBytecode : void* -> "void*"
# BytecodeLength : UINT_PTR -> "int"
# ppReflector : ID3D10ShaderReflection** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。