ホーム › Graphics.Direct3D.Fxc › D3DStripShader
D3DStripShader
関数シェーダーから不要な情報を除去する。
シグネチャ
// D3DCOMPILER_47.dll
#include <windows.h>
HRESULT D3DStripShader(
const void* pShaderBytecode,
UINT_PTR BytecodeLength,
DWORD uStripFlags,
ID3DBlob** ppStrippedBlob
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pShaderBytecode | void* | in |
| BytecodeLength | UINT_PTR | in |
| uStripFlags | DWORD | in |
| ppStrippedBlob | ID3DBlob** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// D3DCOMPILER_47.dll
#include <windows.h>
HRESULT D3DStripShader(
const void* pShaderBytecode,
UINT_PTR BytecodeLength,
DWORD uStripFlags,
ID3DBlob** ppStrippedBlob
);[DllImport("D3DCOMPILER_47.dll", ExactSpelling = true)]
static extern int D3DStripShader(
IntPtr pShaderBytecode, // void*
UIntPtr BytecodeLength, // UINT_PTR
uint uStripFlags, // DWORD
IntPtr ppStrippedBlob // ID3DBlob** out
);<DllImport("D3DCOMPILER_47.dll", ExactSpelling:=True)>
Public Shared Function D3DStripShader(
pShaderBytecode As IntPtr, ' void*
BytecodeLength As UIntPtr, ' UINT_PTR
uStripFlags As UInteger, ' DWORD
ppStrippedBlob As IntPtr ' ID3DBlob** out
) As Integer
End Function' pShaderBytecode : void*
' BytecodeLength : UINT_PTR
' uStripFlags : DWORD
' ppStrippedBlob : ID3DBlob** out
Declare PtrSafe Function D3DStripShader Lib "d3dcompiler_47" ( _
ByVal pShaderBytecode As LongPtr, _
ByVal BytecodeLength As LongPtr, _
ByVal uStripFlags As Long, _
ByVal ppStrippedBlob As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3DStripShader = ctypes.windll.d3dcompiler_47.D3DStripShader
D3DStripShader.restype = ctypes.c_int
D3DStripShader.argtypes = [
ctypes.POINTER(None), # pShaderBytecode : void*
ctypes.c_size_t, # BytecodeLength : UINT_PTR
wintypes.DWORD, # uStripFlags : DWORD
ctypes.c_void_p, # ppStrippedBlob : ID3DBlob** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('D3DCOMPILER_47.dll')
D3DStripShader = Fiddle::Function.new(
lib['D3DStripShader'],
[
Fiddle::TYPE_VOIDP, # pShaderBytecode : void*
Fiddle::TYPE_UINTPTR_T, # BytecodeLength : UINT_PTR
-Fiddle::TYPE_INT, # uStripFlags : DWORD
Fiddle::TYPE_VOIDP, # ppStrippedBlob : ID3DBlob** out
],
Fiddle::TYPE_INT)#[link(name = "d3dcompiler_47")]
extern "system" {
fn D3DStripShader(
pShaderBytecode: *const (), // void*
BytecodeLength: usize, // UINT_PTR
uStripFlags: u32, // DWORD
ppStrippedBlob: *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 D3DStripShader(IntPtr pShaderBytecode, UIntPtr BytecodeLength, uint uStripFlags, IntPtr ppStrippedBlob);
"@
$api = Add-Type -MemberDefinition $sig -Name 'D3DCOMPILER_47_D3DStripShader' -Namespace Win32 -PassThru
# $api::D3DStripShader(pShaderBytecode, BytecodeLength, uStripFlags, ppStrippedBlob)#uselib "D3DCOMPILER_47.dll"
#func global D3DStripShader "D3DStripShader" sptr, sptr, sptr, sptr
; D3DStripShader pShaderBytecode, BytecodeLength, uStripFlags, ppStrippedBlob ; 戻り値は stat
; pShaderBytecode : void* -> "sptr"
; BytecodeLength : UINT_PTR -> "sptr"
; uStripFlags : DWORD -> "sptr"
; ppStrippedBlob : ID3DBlob** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DStripShader "D3DStripShader" sptr, sptr, int, sptr
; res = D3DStripShader(pShaderBytecode, BytecodeLength, uStripFlags, ppStrippedBlob)
; pShaderBytecode : void* -> "sptr"
; BytecodeLength : UINT_PTR -> "sptr"
; uStripFlags : DWORD -> "int"
; ppStrippedBlob : ID3DBlob** out -> "sptr"; HRESULT D3DStripShader(void* pShaderBytecode, UINT_PTR BytecodeLength, DWORD uStripFlags, ID3DBlob** ppStrippedBlob)
#uselib "D3DCOMPILER_47.dll"
#cfunc global D3DStripShader "D3DStripShader" intptr, intptr, int, intptr
; res = D3DStripShader(pShaderBytecode, BytecodeLength, uStripFlags, ppStrippedBlob)
; pShaderBytecode : void* -> "intptr"
; BytecodeLength : UINT_PTR -> "intptr"
; uStripFlags : DWORD -> "int"
; ppStrippedBlob : ID3DBlob** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3dcompiler_47 = windows.NewLazySystemDLL("D3DCOMPILER_47.dll")
procD3DStripShader = d3dcompiler_47.NewProc("D3DStripShader")
)
// pShaderBytecode (void*), BytecodeLength (UINT_PTR), uStripFlags (DWORD), ppStrippedBlob (ID3DBlob** out)
r1, _, err := procD3DStripShader.Call(
uintptr(pShaderBytecode),
uintptr(BytecodeLength),
uintptr(uStripFlags),
uintptr(ppStrippedBlob),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3DStripShader(
pShaderBytecode: Pointer; // void*
BytecodeLength: NativeUInt; // UINT_PTR
uStripFlags: DWORD; // DWORD
ppStrippedBlob: Pointer // ID3DBlob** out
): Integer; stdcall;
external 'D3DCOMPILER_47.dll' name 'D3DStripShader';result := DllCall("D3DCOMPILER_47\D3DStripShader"
, "Ptr", pShaderBytecode ; void*
, "UPtr", BytecodeLength ; UINT_PTR
, "UInt", uStripFlags ; DWORD
, "Ptr", ppStrippedBlob ; ID3DBlob** out
, "Int") ; return: HRESULT●D3DStripShader(pShaderBytecode, BytecodeLength, uStripFlags, ppStrippedBlob) = DLL("D3DCOMPILER_47.dll", "int D3DStripShader(void*, int, dword, void*)")
# 呼び出し: D3DStripShader(pShaderBytecode, BytecodeLength, uStripFlags, ppStrippedBlob)
# pShaderBytecode : void* -> "void*"
# BytecodeLength : UINT_PTR -> "int"
# uStripFlags : DWORD -> "dword"
# ppStrippedBlob : ID3DBlob** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。