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

D3D12SerializeRootSignature

関数
ルートシグネチャの記述子をシリアライズしてブロブに変換する。
DLLd3d12.dll呼出規約winapi

シグネチャ

// d3d12.dll
#include <windows.h>

HRESULT D3D12SerializeRootSignature(
    const D3D12_ROOT_SIGNATURE_DESC* pRootSignature,
    D3D_ROOT_SIGNATURE_VERSION Version,
    ID3DBlob** ppBlob,
    ID3DBlob** ppErrorBlob   // optional
);

パラメーター

名前方向
pRootSignatureD3D12_ROOT_SIGNATURE_DESC*in
VersionD3D_ROOT_SIGNATURE_VERSIONin
ppBlobID3DBlob**out
ppErrorBlobID3DBlob**outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

// d3d12.dll
#include <windows.h>

HRESULT D3D12SerializeRootSignature(
    const D3D12_ROOT_SIGNATURE_DESC* pRootSignature,
    D3D_ROOT_SIGNATURE_VERSION Version,
    ID3DBlob** ppBlob,
    ID3DBlob** ppErrorBlob   // optional
);
[DllImport("d3d12.dll", ExactSpelling = true)]
static extern int D3D12SerializeRootSignature(
    IntPtr pRootSignature,   // D3D12_ROOT_SIGNATURE_DESC*
    int Version,   // D3D_ROOT_SIGNATURE_VERSION
    IntPtr ppBlob,   // ID3DBlob** out
    IntPtr ppErrorBlob   // ID3DBlob** optional, out
);
<DllImport("d3d12.dll", ExactSpelling:=True)>
Public Shared Function D3D12SerializeRootSignature(
    pRootSignature As IntPtr,   ' D3D12_ROOT_SIGNATURE_DESC*
    Version As Integer,   ' D3D_ROOT_SIGNATURE_VERSION
    ppBlob As IntPtr,   ' ID3DBlob** out
    ppErrorBlob As IntPtr   ' ID3DBlob** optional, out
) As Integer
End Function
' pRootSignature : D3D12_ROOT_SIGNATURE_DESC*
' Version : D3D_ROOT_SIGNATURE_VERSION
' ppBlob : ID3DBlob** out
' ppErrorBlob : ID3DBlob** optional, out
Declare PtrSafe Function D3D12SerializeRootSignature Lib "d3d12" ( _
    ByVal pRootSignature As LongPtr, _
    ByVal Version As Long, _
    ByVal ppBlob As LongPtr, _
    ByVal ppErrorBlob As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

D3D12SerializeRootSignature = ctypes.windll.d3d12.D3D12SerializeRootSignature
D3D12SerializeRootSignature.restype = ctypes.c_int
D3D12SerializeRootSignature.argtypes = [
    ctypes.c_void_p,  # pRootSignature : D3D12_ROOT_SIGNATURE_DESC*
    ctypes.c_int,  # Version : D3D_ROOT_SIGNATURE_VERSION
    ctypes.c_void_p,  # ppBlob : ID3DBlob** out
    ctypes.c_void_p,  # ppErrorBlob : ID3DBlob** optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('d3d12.dll')
D3D12SerializeRootSignature = Fiddle::Function.new(
  lib['D3D12SerializeRootSignature'],
  [
    Fiddle::TYPE_VOIDP,  # pRootSignature : D3D12_ROOT_SIGNATURE_DESC*
    Fiddle::TYPE_INT,  # Version : D3D_ROOT_SIGNATURE_VERSION
    Fiddle::TYPE_VOIDP,  # ppBlob : ID3DBlob** out
    Fiddle::TYPE_VOIDP,  # ppErrorBlob : ID3DBlob** optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "d3d12")]
extern "system" {
    fn D3D12SerializeRootSignature(
        pRootSignature: *const D3D12_ROOT_SIGNATURE_DESC,  // D3D12_ROOT_SIGNATURE_DESC*
        Version: i32,  // D3D_ROOT_SIGNATURE_VERSION
        ppBlob: *mut *mut core::ffi::c_void,  // ID3DBlob** out
        ppErrorBlob: *mut *mut core::ffi::c_void  // ID3DBlob** optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("d3d12.dll")]
public static extern int D3D12SerializeRootSignature(IntPtr pRootSignature, int Version, IntPtr ppBlob, IntPtr ppErrorBlob);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d12_D3D12SerializeRootSignature' -Namespace Win32 -PassThru
# $api::D3D12SerializeRootSignature(pRootSignature, Version, ppBlob, ppErrorBlob)
#uselib "d3d12.dll"
#func global D3D12SerializeRootSignature "D3D12SerializeRootSignature" sptr, sptr, sptr, sptr
; D3D12SerializeRootSignature varptr(pRootSignature), Version, ppBlob, ppErrorBlob   ; 戻り値は stat
; pRootSignature : D3D12_ROOT_SIGNATURE_DESC* -> "sptr"
; Version : D3D_ROOT_SIGNATURE_VERSION -> "sptr"
; ppBlob : ID3DBlob** out -> "sptr"
; ppErrorBlob : ID3DBlob** optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "d3d12.dll"
#cfunc global D3D12SerializeRootSignature "D3D12SerializeRootSignature" var, int, sptr, sptr
; res = D3D12SerializeRootSignature(pRootSignature, Version, ppBlob, ppErrorBlob)
; pRootSignature : D3D12_ROOT_SIGNATURE_DESC* -> "var"
; Version : D3D_ROOT_SIGNATURE_VERSION -> "int"
; ppBlob : ID3DBlob** out -> "sptr"
; ppErrorBlob : ID3DBlob** optional, out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT D3D12SerializeRootSignature(D3D12_ROOT_SIGNATURE_DESC* pRootSignature, D3D_ROOT_SIGNATURE_VERSION Version, ID3DBlob** ppBlob, ID3DBlob** ppErrorBlob)
#uselib "d3d12.dll"
#cfunc global D3D12SerializeRootSignature "D3D12SerializeRootSignature" var, int, intptr, intptr
; res = D3D12SerializeRootSignature(pRootSignature, Version, ppBlob, ppErrorBlob)
; pRootSignature : D3D12_ROOT_SIGNATURE_DESC* -> "var"
; Version : D3D_ROOT_SIGNATURE_VERSION -> "int"
; ppBlob : ID3DBlob** out -> "intptr"
; ppErrorBlob : ID3DBlob** optional, out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	d3d12 = windows.NewLazySystemDLL("d3d12.dll")
	procD3D12SerializeRootSignature = d3d12.NewProc("D3D12SerializeRootSignature")
)

// pRootSignature (D3D12_ROOT_SIGNATURE_DESC*), Version (D3D_ROOT_SIGNATURE_VERSION), ppBlob (ID3DBlob** out), ppErrorBlob (ID3DBlob** optional, out)
r1, _, err := procD3D12SerializeRootSignature.Call(
	uintptr(pRootSignature),
	uintptr(Version),
	uintptr(ppBlob),
	uintptr(ppErrorBlob),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function D3D12SerializeRootSignature(
  pRootSignature: Pointer;   // D3D12_ROOT_SIGNATURE_DESC*
  Version: Integer;   // D3D_ROOT_SIGNATURE_VERSION
  ppBlob: Pointer;   // ID3DBlob** out
  ppErrorBlob: Pointer   // ID3DBlob** optional, out
): Integer; stdcall;
  external 'd3d12.dll' name 'D3D12SerializeRootSignature';
result := DllCall("d3d12\D3D12SerializeRootSignature"
    , "Ptr", pRootSignature   ; D3D12_ROOT_SIGNATURE_DESC*
    , "Int", Version   ; D3D_ROOT_SIGNATURE_VERSION
    , "Ptr", ppBlob   ; ID3DBlob** out
    , "Ptr", ppErrorBlob   ; ID3DBlob** optional, out
    , "Int")   ; return: HRESULT
●D3D12SerializeRootSignature(pRootSignature, Version, ppBlob, ppErrorBlob) = DLL("d3d12.dll", "int D3D12SerializeRootSignature(void*, int, void*, void*)")
# 呼び出し: D3D12SerializeRootSignature(pRootSignature, Version, ppBlob, ppErrorBlob)
# pRootSignature : D3D12_ROOT_SIGNATURE_DESC* -> "void*"
# Version : D3D_ROOT_SIGNATURE_VERSION -> "int"
# ppBlob : ID3DBlob** out -> "void*"
# ppErrorBlob : ID3DBlob** optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。