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

D3DGetDebugInfo

関数
コンパイル済みシェーダーのデバッグ情報を取得する。
DLLD3DCOMPILER_47.dll呼出規約winapi

シグネチャ

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

HRESULT D3DGetDebugInfo(
    const void* pSrcData,
    UINT_PTR SrcDataSize,
    ID3DBlob** ppDebugInfo
);

パラメーター

名前方向説明
pSrcDatavoid*inデバッグ情報を抽出する元のシェーダーデータへのポインター。
SrcDataSizeUINT_PTRinpSrcDataのバイトサイズ。
ppDebugInfoID3DBlob**out抽出されたデバッグ情報を受け取るID3DBlob出力ポインター。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

D3DGetDebugInfo = ctypes.windll.d3dcompiler_47.D3DGetDebugInfo
D3DGetDebugInfo.restype = ctypes.c_int
D3DGetDebugInfo.argtypes = [
    ctypes.POINTER(None),  # pSrcData : void*
    ctypes.c_size_t,  # SrcDataSize : UINT_PTR
    ctypes.c_void_p,  # ppDebugInfo : ID3DBlob** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('D3DCOMPILER_47.dll')
D3DGetDebugInfo = Fiddle::Function.new(
  lib['D3DGetDebugInfo'],
  [
    Fiddle::TYPE_VOIDP,  # pSrcData : void*
    Fiddle::TYPE_UINTPTR_T,  # SrcDataSize : UINT_PTR
    Fiddle::TYPE_VOIDP,  # ppDebugInfo : ID3DBlob** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "d3dcompiler_47")]
extern "system" {
    fn D3DGetDebugInfo(
        pSrcData: *const (),  // void*
        SrcDataSize: usize,  // UINT_PTR
        ppDebugInfo: *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 D3DGetDebugInfo(IntPtr pSrcData, UIntPtr SrcDataSize, IntPtr ppDebugInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'D3DCOMPILER_47_D3DGetDebugInfo' -Namespace Win32 -PassThru
# $api::D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo)
#uselib "D3DCOMPILER_47.dll"
#func global D3DGetDebugInfo "D3DGetDebugInfo" sptr, sptr, sptr
; D3DGetDebugInfo pSrcData, SrcDataSize, ppDebugInfo   ; 戻り値は stat
; pSrcData : void* -> "sptr"
; SrcDataSize : UINT_PTR -> "sptr"
; ppDebugInfo : ID3DBlob** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DGetDebugInfo "D3DGetDebugInfo" sptr, sptr, sptr
; res = D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo)
; pSrcData : void* -> "sptr"
; SrcDataSize : UINT_PTR -> "sptr"
; ppDebugInfo : ID3DBlob** out -> "sptr"
; HRESULT D3DGetDebugInfo(void* pSrcData, UINT_PTR SrcDataSize, ID3DBlob** ppDebugInfo)
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DGetDebugInfo "D3DGetDebugInfo" intptr, intptr, intptr
; res = D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo)
; pSrcData : void* -> "intptr"
; SrcDataSize : UINT_PTR -> "intptr"
; ppDebugInfo : ID3DBlob** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	d3dcompiler_47 = windows.NewLazySystemDLL("D3DCOMPILER_47.dll")
	procD3DGetDebugInfo = d3dcompiler_47.NewProc("D3DGetDebugInfo")
)

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

extern "d3dcompiler_47" fn D3DGetDebugInfo(
    pSrcData: ?*anyopaque, // void*
    SrcDataSize: usize, // UINT_PTR
    ppDebugInfo: ?*anyopaque // ID3DBlob** out
) callconv(std.os.windows.WINAPI) i32;
proc D3DGetDebugInfo(
    pSrcData: pointer,  # void*
    SrcDataSize: uint,  # UINT_PTR
    ppDebugInfo: pointer  # ID3DBlob** out
): int32 {.importc: "D3DGetDebugInfo", stdcall, dynlib: "D3DCOMPILER_47.dll".}
pragma(lib, "d3dcompiler_47");
extern(Windows)
int D3DGetDebugInfo(
    void* pSrcData,   // void*
    size_t SrcDataSize,   // UINT_PTR
    void* ppDebugInfo   // ID3DBlob** out
);
ccall((:D3DGetDebugInfo, "D3DCOMPILER_47.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Csize_t, Ptr{Cvoid}),
      pSrcData, SrcDataSize, ppDebugInfo)
# pSrcData : void* -> Ptr{Cvoid}
# SrcDataSize : UINT_PTR -> Csize_t
# ppDebugInfo : ID3DBlob** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t D3DGetDebugInfo(
    void* pSrcData,
    uintptr_t SrcDataSize,
    void* ppDebugInfo);
]]
local d3dcompiler_47 = ffi.load("d3dcompiler_47")
-- d3dcompiler_47.D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo)
-- pSrcData : void*
-- SrcDataSize : UINT_PTR
-- ppDebugInfo : ID3DBlob** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('D3DCOMPILER_47.dll');
const D3DGetDebugInfo = lib.func('__stdcall', 'D3DGetDebugInfo', 'int32_t', ['void *', 'uintptr_t', 'void *']);
// D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo)
// pSrcData : void* -> 'void *'
// SrcDataSize : UINT_PTR -> 'uintptr_t'
// ppDebugInfo : ID3DBlob** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("D3DCOMPILER_47.dll", {
  D3DGetDebugInfo: { parameters: ["pointer", "usize", "pointer"], result: "i32" },
});
// lib.symbols.D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo)
// pSrcData : void* -> "pointer"
// SrcDataSize : UINT_PTR -> "usize"
// ppDebugInfo : ID3DBlob** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t D3DGetDebugInfo(
    void* pSrcData,
    size_t SrcDataSize,
    void* ppDebugInfo);
C, "D3DCOMPILER_47.dll");
// $ffi->D3DGetDebugInfo(pSrcData, SrcDataSize, ppDebugInfo);
// pSrcData : void*
// SrcDataSize : UINT_PTR
// ppDebugInfo : ID3DBlob** 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 D3dcompiler_47 extends StdCallLibrary {
    D3dcompiler_47 INSTANCE = Native.load("d3dcompiler_47", D3dcompiler_47.class);
    int D3DGetDebugInfo(
        Pointer pSrcData,   // void*
        long SrcDataSize,   // UINT_PTR
        Pointer ppDebugInfo   // ID3DBlob** out
    );
}
@[Link("d3dcompiler_47")]
lib LibD3DCOMPILER_47
  fun D3DGetDebugInfo = D3DGetDebugInfo(
    pSrcData : Void*,   # void*
    SrcDataSize : LibC::SizeT,   # UINT_PTR
    ppDebugInfo : Void*   # ID3DBlob** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef D3DGetDebugInfoNative = Int32 Function(Pointer<Void>, UintPtr, Pointer<Void>);
typedef D3DGetDebugInfoDart = int Function(Pointer<Void>, int, Pointer<Void>);
final D3DGetDebugInfo = DynamicLibrary.open('D3DCOMPILER_47.dll')
    .lookupFunction<D3DGetDebugInfoNative, D3DGetDebugInfoDart>('D3DGetDebugInfo');
// pSrcData : void* -> Pointer<Void>
// SrcDataSize : UINT_PTR -> UintPtr
// ppDebugInfo : ID3DBlob** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function D3DGetDebugInfo(
  pSrcData: Pointer;   // void*
  SrcDataSize: NativeUInt;   // UINT_PTR
  ppDebugInfo: Pointer   // ID3DBlob** out
): Integer; stdcall;
  external 'D3DCOMPILER_47.dll' name 'D3DGetDebugInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "D3DGetDebugInfo"
  c_D3DGetDebugInfo :: Ptr () -> CUIntPtr -> Ptr () -> IO Int32
-- pSrcData : void* -> Ptr ()
-- SrcDataSize : UINT_PTR -> CUIntPtr
-- ppDebugInfo : ID3DBlob** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let d3dgetdebuginfo =
  foreign "D3DGetDebugInfo"
    ((ptr void) @-> size_t @-> (ptr void) @-> returning int32_t)
(* pSrcData : void* -> (ptr void) *)
(* SrcDataSize : UINT_PTR -> size_t *)
(* ppDebugInfo : ID3DBlob** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library d3dcompiler_47 (t "D3DCOMPILER_47.dll"))
(cffi:use-foreign-library d3dcompiler_47)

(cffi:defcfun ("D3DGetDebugInfo" d3-dget-debug-info :convention :stdcall) :int32
  (p-src-data :pointer)   ; void*
  (src-data-size :uint64)   ; UINT_PTR
  (pp-debug-info :pointer))   ; ID3DBlob** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $D3DGetDebugInfo = Win32::API::More->new('D3DCOMPILER_47',
    'int D3DGetDebugInfo(LPVOID pSrcData, WPARAM SrcDataSize, LPVOID ppDebugInfo)');
# my $ret = $D3DGetDebugInfo->Call($pSrcData, $SrcDataSize, $ppDebugInfo);
# pSrcData : void* -> LPVOID
# SrcDataSize : UINT_PTR -> WPARAM
# ppDebugInfo : ID3DBlob** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型