Win32 API 日本語リファレンス
ホームGraphics.Direct3D.Fxc › D3DGetBlobPart

D3DGetBlobPart

関数
コンパイル済みシェーダーバイナリから指定した部分データ(ブロブ)を取得する。
DLLD3DCOMPILER_47.dll呼出規約winapi

シグネチャ

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

HRESULT D3DGetBlobPart(
    const void* pSrcData,
    UINT_PTR SrcDataSize,
    D3D_BLOB_PART Part,
    DWORD Flags,
    ID3DBlob** ppPart
);

パラメーター

名前方向
pSrcDatavoid*in
SrcDataSizeUINT_PTRin
PartD3D_BLOB_PARTin
FlagsDWORDin
ppPartID3DBlob**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT D3DGetBlobPart(
    const void* pSrcData,
    UINT_PTR SrcDataSize,
    D3D_BLOB_PART Part,
    DWORD Flags,
    ID3DBlob** ppPart
);
[DllImport("D3DCOMPILER_47.dll", ExactSpelling = true)]
static extern int D3DGetBlobPart(
    IntPtr pSrcData,   // void*
    UIntPtr SrcDataSize,   // UINT_PTR
    int Part,   // D3D_BLOB_PART
    uint Flags,   // DWORD
    IntPtr ppPart   // ID3DBlob** out
);
<DllImport("D3DCOMPILER_47.dll", ExactSpelling:=True)>
Public Shared Function D3DGetBlobPart(
    pSrcData As IntPtr,   ' void*
    SrcDataSize As UIntPtr,   ' UINT_PTR
    Part As Integer,   ' D3D_BLOB_PART
    Flags As UInteger,   ' DWORD
    ppPart As IntPtr   ' ID3DBlob** out
) As Integer
End Function
' pSrcData : void*
' SrcDataSize : UINT_PTR
' Part : D3D_BLOB_PART
' Flags : DWORD
' ppPart : ID3DBlob** out
Declare PtrSafe Function D3DGetBlobPart Lib "d3dcompiler_47" ( _
    ByVal pSrcData As LongPtr, _
    ByVal SrcDataSize As LongPtr, _
    ByVal Part As Long, _
    ByVal Flags As Long, _
    ByVal ppPart As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

D3DGetBlobPart = ctypes.windll.d3dcompiler_47.D3DGetBlobPart
D3DGetBlobPart.restype = ctypes.c_int
D3DGetBlobPart.argtypes = [
    ctypes.POINTER(None),  # pSrcData : void*
    ctypes.c_size_t,  # SrcDataSize : UINT_PTR
    ctypes.c_int,  # Part : D3D_BLOB_PART
    wintypes.DWORD,  # Flags : DWORD
    ctypes.c_void_p,  # ppPart : ID3DBlob** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('D3DCOMPILER_47.dll')
D3DGetBlobPart = Fiddle::Function.new(
  lib['D3DGetBlobPart'],
  [
    Fiddle::TYPE_VOIDP,  # pSrcData : void*
    Fiddle::TYPE_UINTPTR_T,  # SrcDataSize : UINT_PTR
    Fiddle::TYPE_INT,  # Part : D3D_BLOB_PART
    -Fiddle::TYPE_INT,  # Flags : DWORD
    Fiddle::TYPE_VOIDP,  # ppPart : ID3DBlob** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "d3dcompiler_47")]
extern "system" {
    fn D3DGetBlobPart(
        pSrcData: *const (),  // void*
        SrcDataSize: usize,  // UINT_PTR
        Part: i32,  // D3D_BLOB_PART
        Flags: u32,  // DWORD
        ppPart: *mut *mut core::ffi::c_void  // ID3DBlob** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("D3DCOMPILER_47.dll")]
public static extern int D3DGetBlobPart(IntPtr pSrcData, UIntPtr SrcDataSize, int Part, uint Flags, IntPtr ppPart);
"@
$api = Add-Type -MemberDefinition $sig -Name 'D3DCOMPILER_47_D3DGetBlobPart' -Namespace Win32 -PassThru
# $api::D3DGetBlobPart(pSrcData, SrcDataSize, Part, Flags, ppPart)
#uselib "D3DCOMPILER_47.dll"
#func global D3DGetBlobPart "D3DGetBlobPart" sptr, sptr, sptr, sptr, sptr
; D3DGetBlobPart pSrcData, SrcDataSize, Part, Flags, ppPart   ; 戻り値は stat
; pSrcData : void* -> "sptr"
; SrcDataSize : UINT_PTR -> "sptr"
; Part : D3D_BLOB_PART -> "sptr"
; Flags : DWORD -> "sptr"
; ppPart : ID3DBlob** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DGetBlobPart "D3DGetBlobPart" sptr, sptr, int, int, sptr
; res = D3DGetBlobPart(pSrcData, SrcDataSize, Part, Flags, ppPart)
; pSrcData : void* -> "sptr"
; SrcDataSize : UINT_PTR -> "sptr"
; Part : D3D_BLOB_PART -> "int"
; Flags : DWORD -> "int"
; ppPart : ID3DBlob** out -> "sptr"
; HRESULT D3DGetBlobPart(void* pSrcData, UINT_PTR SrcDataSize, D3D_BLOB_PART Part, DWORD Flags, ID3DBlob** ppPart)
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DGetBlobPart "D3DGetBlobPart" intptr, intptr, int, int, intptr
; res = D3DGetBlobPart(pSrcData, SrcDataSize, Part, Flags, ppPart)
; pSrcData : void* -> "intptr"
; SrcDataSize : UINT_PTR -> "intptr"
; Part : D3D_BLOB_PART -> "int"
; Flags : DWORD -> "int"
; ppPart : ID3DBlob** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	d3dcompiler_47 = windows.NewLazySystemDLL("D3DCOMPILER_47.dll")
	procD3DGetBlobPart = d3dcompiler_47.NewProc("D3DGetBlobPart")
)

// pSrcData (void*), SrcDataSize (UINT_PTR), Part (D3D_BLOB_PART), Flags (DWORD), ppPart (ID3DBlob** out)
r1, _, err := procD3DGetBlobPart.Call(
	uintptr(pSrcData),
	uintptr(SrcDataSize),
	uintptr(Part),
	uintptr(Flags),
	uintptr(ppPart),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function D3DGetBlobPart(
  pSrcData: Pointer;   // void*
  SrcDataSize: NativeUInt;   // UINT_PTR
  Part: Integer;   // D3D_BLOB_PART
  Flags: DWORD;   // DWORD
  ppPart: Pointer   // ID3DBlob** out
): Integer; stdcall;
  external 'D3DCOMPILER_47.dll' name 'D3DGetBlobPart';
result := DllCall("D3DCOMPILER_47\D3DGetBlobPart"
    , "Ptr", pSrcData   ; void*
    , "UPtr", SrcDataSize   ; UINT_PTR
    , "Int", Part   ; D3D_BLOB_PART
    , "UInt", Flags   ; DWORD
    , "Ptr", ppPart   ; ID3DBlob** out
    , "Int")   ; return: HRESULT
●D3DGetBlobPart(pSrcData, SrcDataSize, Part, Flags, ppPart) = DLL("D3DCOMPILER_47.dll", "int D3DGetBlobPart(void*, int, int, dword, void*)")
# 呼び出し: D3DGetBlobPart(pSrcData, SrcDataSize, Part, Flags, ppPart)
# pSrcData : void* -> "void*"
# SrcDataSize : UINT_PTR -> "int"
# Part : D3D_BLOB_PART -> "int"
# Flags : DWORD -> "dword"
# ppPart : ID3DBlob** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。