ホーム › Graphics.Direct3D10 › D3D10CreateEffectPoolFromMemory
D3D10CreateEffectPoolFromMemory
関数メモリ上のエフェクトデータから共有エフェクトプールを作成する。
シグネチャ
// d3d10.dll
#include <windows.h>
HRESULT D3D10CreateEffectPoolFromMemory(
void* pData,
UINT_PTR DataLength,
DWORD FXFlags,
ID3D10Device* pDevice,
ID3D10EffectPool** ppEffectPool
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pData | void* | in | コンパイル済みプールエフェクトデータの先頭ポインター。 |
| DataLength | UINT_PTR | in | pDataが指すデータのバイト数を指定する。 |
| FXFlags | DWORD | in | プール生成を制御するD3D10_EFFECT系フラグの組み合わせ。 |
| pDevice | ID3D10Device* | in | エフェクトプールを関連付ける対象のID3D10Device。 |
| ppEffectPool | ID3D10EffectPool** | out | 生成されたID3D10EffectPoolを受け取る出力先。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// d3d10.dll
#include <windows.h>
HRESULT D3D10CreateEffectPoolFromMemory(
void* pData,
UINT_PTR DataLength,
DWORD FXFlags,
ID3D10Device* pDevice,
ID3D10EffectPool** ppEffectPool
);[DllImport("d3d10.dll", ExactSpelling = true)]
static extern int D3D10CreateEffectPoolFromMemory(
IntPtr pData, // void*
UIntPtr DataLength, // UINT_PTR
uint FXFlags, // DWORD
IntPtr pDevice, // ID3D10Device*
IntPtr ppEffectPool // ID3D10EffectPool** out
);<DllImport("d3d10.dll", ExactSpelling:=True)>
Public Shared Function D3D10CreateEffectPoolFromMemory(
pData As IntPtr, ' void*
DataLength As UIntPtr, ' UINT_PTR
FXFlags As UInteger, ' DWORD
pDevice As IntPtr, ' ID3D10Device*
ppEffectPool As IntPtr ' ID3D10EffectPool** out
) As Integer
End Function' pData : void*
' DataLength : UINT_PTR
' FXFlags : DWORD
' pDevice : ID3D10Device*
' ppEffectPool : ID3D10EffectPool** out
Declare PtrSafe Function D3D10CreateEffectPoolFromMemory Lib "d3d10" ( _
ByVal pData As LongPtr, _
ByVal DataLength As LongPtr, _
ByVal FXFlags As Long, _
ByVal pDevice As LongPtr, _
ByVal ppEffectPool As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3D10CreateEffectPoolFromMemory = ctypes.windll.d3d10.D3D10CreateEffectPoolFromMemory
D3D10CreateEffectPoolFromMemory.restype = ctypes.c_int
D3D10CreateEffectPoolFromMemory.argtypes = [
ctypes.POINTER(None), # pData : void*
ctypes.c_size_t, # DataLength : UINT_PTR
wintypes.DWORD, # FXFlags : DWORD
ctypes.c_void_p, # pDevice : ID3D10Device*
ctypes.c_void_p, # ppEffectPool : ID3D10EffectPool** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('d3d10.dll')
D3D10CreateEffectPoolFromMemory = Fiddle::Function.new(
lib['D3D10CreateEffectPoolFromMemory'],
[
Fiddle::TYPE_VOIDP, # pData : void*
Fiddle::TYPE_UINTPTR_T, # DataLength : UINT_PTR
-Fiddle::TYPE_INT, # FXFlags : DWORD
Fiddle::TYPE_VOIDP, # pDevice : ID3D10Device*
Fiddle::TYPE_VOIDP, # ppEffectPool : ID3D10EffectPool** out
],
Fiddle::TYPE_INT)#[link(name = "d3d10")]
extern "system" {
fn D3D10CreateEffectPoolFromMemory(
pData: *mut (), // void*
DataLength: usize, // UINT_PTR
FXFlags: u32, // DWORD
pDevice: *mut core::ffi::c_void, // ID3D10Device*
ppEffectPool: *mut *mut core::ffi::c_void // ID3D10EffectPool** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("d3d10.dll")]
public static extern int D3D10CreateEffectPoolFromMemory(IntPtr pData, UIntPtr DataLength, uint FXFlags, IntPtr pDevice, IntPtr ppEffectPool);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d10_D3D10CreateEffectPoolFromMemory' -Namespace Win32 -PassThru
# $api::D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)#uselib "d3d10.dll"
#func global D3D10CreateEffectPoolFromMemory "D3D10CreateEffectPoolFromMemory" sptr, sptr, sptr, sptr, sptr
; D3D10CreateEffectPoolFromMemory pData, DataLength, FXFlags, pDevice, ppEffectPool ; 戻り値は stat
; pData : void* -> "sptr"
; DataLength : UINT_PTR -> "sptr"
; FXFlags : DWORD -> "sptr"
; pDevice : ID3D10Device* -> "sptr"
; ppEffectPool : ID3D10EffectPool** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "d3d10.dll"
#cfunc global D3D10CreateEffectPoolFromMemory "D3D10CreateEffectPoolFromMemory" sptr, sptr, int, sptr, sptr
; res = D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)
; pData : void* -> "sptr"
; DataLength : UINT_PTR -> "sptr"
; FXFlags : DWORD -> "int"
; pDevice : ID3D10Device* -> "sptr"
; ppEffectPool : ID3D10EffectPool** out -> "sptr"; HRESULT D3D10CreateEffectPoolFromMemory(void* pData, UINT_PTR DataLength, DWORD FXFlags, ID3D10Device* pDevice, ID3D10EffectPool** ppEffectPool)
#uselib "d3d10.dll"
#cfunc global D3D10CreateEffectPoolFromMemory "D3D10CreateEffectPoolFromMemory" intptr, intptr, int, intptr, intptr
; res = D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)
; pData : void* -> "intptr"
; DataLength : UINT_PTR -> "intptr"
; FXFlags : DWORD -> "int"
; pDevice : ID3D10Device* -> "intptr"
; ppEffectPool : ID3D10EffectPool** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3d10 = windows.NewLazySystemDLL("d3d10.dll")
procD3D10CreateEffectPoolFromMemory = d3d10.NewProc("D3D10CreateEffectPoolFromMemory")
)
// pData (void*), DataLength (UINT_PTR), FXFlags (DWORD), pDevice (ID3D10Device*), ppEffectPool (ID3D10EffectPool** out)
r1, _, err := procD3D10CreateEffectPoolFromMemory.Call(
uintptr(pData),
uintptr(DataLength),
uintptr(FXFlags),
uintptr(pDevice),
uintptr(ppEffectPool),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3D10CreateEffectPoolFromMemory(
pData: Pointer; // void*
DataLength: NativeUInt; // UINT_PTR
FXFlags: DWORD; // DWORD
pDevice: Pointer; // ID3D10Device*
ppEffectPool: Pointer // ID3D10EffectPool** out
): Integer; stdcall;
external 'd3d10.dll' name 'D3D10CreateEffectPoolFromMemory';result := DllCall("d3d10\D3D10CreateEffectPoolFromMemory"
, "Ptr", pData ; void*
, "UPtr", DataLength ; UINT_PTR
, "UInt", FXFlags ; DWORD
, "Ptr", pDevice ; ID3D10Device*
, "Ptr", ppEffectPool ; ID3D10EffectPool** out
, "Int") ; return: HRESULT●D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool) = DLL("d3d10.dll", "int D3D10CreateEffectPoolFromMemory(void*, int, dword, void*, void*)")
# 呼び出し: D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)
# pData : void* -> "void*"
# DataLength : UINT_PTR -> "int"
# FXFlags : DWORD -> "dword"
# pDevice : ID3D10Device* -> "void*"
# ppEffectPool : ID3D10EffectPool** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "d3d10" fn D3D10CreateEffectPoolFromMemory(
pData: ?*anyopaque, // void*
DataLength: usize, // UINT_PTR
FXFlags: u32, // DWORD
pDevice: ?*anyopaque, // ID3D10Device*
ppEffectPool: ?*anyopaque // ID3D10EffectPool** out
) callconv(std.os.windows.WINAPI) i32;proc D3D10CreateEffectPoolFromMemory(
pData: pointer, # void*
DataLength: uint, # UINT_PTR
FXFlags: uint32, # DWORD
pDevice: pointer, # ID3D10Device*
ppEffectPool: pointer # ID3D10EffectPool** out
): int32 {.importc: "D3D10CreateEffectPoolFromMemory", stdcall, dynlib: "d3d10.dll".}pragma(lib, "d3d10");
extern(Windows)
int D3D10CreateEffectPoolFromMemory(
void* pData, // void*
size_t DataLength, // UINT_PTR
uint FXFlags, // DWORD
void* pDevice, // ID3D10Device*
void* ppEffectPool // ID3D10EffectPool** out
);ccall((:D3D10CreateEffectPoolFromMemory, "d3d10.dll"), stdcall, Int32,
(Ptr{Cvoid}, Csize_t, UInt32, Ptr{Cvoid}, Ptr{Cvoid}),
pData, DataLength, FXFlags, pDevice, ppEffectPool)
# pData : void* -> Ptr{Cvoid}
# DataLength : UINT_PTR -> Csize_t
# FXFlags : DWORD -> UInt32
# pDevice : ID3D10Device* -> Ptr{Cvoid}
# ppEffectPool : ID3D10EffectPool** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t D3D10CreateEffectPoolFromMemory(
void* pData,
uintptr_t DataLength,
uint32_t FXFlags,
void* pDevice,
void* ppEffectPool);
]]
local d3d10 = ffi.load("d3d10")
-- d3d10.D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)
-- pData : void*
-- DataLength : UINT_PTR
-- FXFlags : DWORD
-- pDevice : ID3D10Device*
-- ppEffectPool : ID3D10EffectPool** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('d3d10.dll');
const D3D10CreateEffectPoolFromMemory = lib.func('__stdcall', 'D3D10CreateEffectPoolFromMemory', 'int32_t', ['void *', 'uintptr_t', 'uint32_t', 'void *', 'void *']);
// D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)
// pData : void* -> 'void *'
// DataLength : UINT_PTR -> 'uintptr_t'
// FXFlags : DWORD -> 'uint32_t'
// pDevice : ID3D10Device* -> 'void *'
// ppEffectPool : ID3D10EffectPool** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("d3d10.dll", {
D3D10CreateEffectPoolFromMemory: { parameters: ["pointer", "usize", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool)
// pData : void* -> "pointer"
// DataLength : UINT_PTR -> "usize"
// FXFlags : DWORD -> "u32"
// pDevice : ID3D10Device* -> "pointer"
// ppEffectPool : ID3D10EffectPool** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t D3D10CreateEffectPoolFromMemory(
void* pData,
size_t DataLength,
uint32_t FXFlags,
void* pDevice,
void* ppEffectPool);
C, "d3d10.dll");
// $ffi->D3D10CreateEffectPoolFromMemory(pData, DataLength, FXFlags, pDevice, ppEffectPool);
// pData : void*
// DataLength : UINT_PTR
// FXFlags : DWORD
// pDevice : ID3D10Device*
// ppEffectPool : ID3D10EffectPool** 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 D3d10 extends StdCallLibrary {
D3d10 INSTANCE = Native.load("d3d10", D3d10.class);
int D3D10CreateEffectPoolFromMemory(
Pointer pData, // void*
long DataLength, // UINT_PTR
int FXFlags, // DWORD
Pointer pDevice, // ID3D10Device*
Pointer ppEffectPool // ID3D10EffectPool** out
);
}@[Link("d3d10")]
lib Libd3d10
fun D3D10CreateEffectPoolFromMemory = D3D10CreateEffectPoolFromMemory(
pData : Void*, # void*
DataLength : LibC::SizeT, # UINT_PTR
FXFlags : UInt32, # DWORD
pDevice : Void*, # ID3D10Device*
ppEffectPool : Void* # ID3D10EffectPool** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef D3D10CreateEffectPoolFromMemoryNative = Int32 Function(Pointer<Void>, UintPtr, Uint32, Pointer<Void>, Pointer<Void>);
typedef D3D10CreateEffectPoolFromMemoryDart = int Function(Pointer<Void>, int, int, Pointer<Void>, Pointer<Void>);
final D3D10CreateEffectPoolFromMemory = DynamicLibrary.open('d3d10.dll')
.lookupFunction<D3D10CreateEffectPoolFromMemoryNative, D3D10CreateEffectPoolFromMemoryDart>('D3D10CreateEffectPoolFromMemory');
// pData : void* -> Pointer<Void>
// DataLength : UINT_PTR -> UintPtr
// FXFlags : DWORD -> Uint32
// pDevice : ID3D10Device* -> Pointer<Void>
// ppEffectPool : ID3D10EffectPool** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function D3D10CreateEffectPoolFromMemory(
pData: Pointer; // void*
DataLength: NativeUInt; // UINT_PTR
FXFlags: DWORD; // DWORD
pDevice: Pointer; // ID3D10Device*
ppEffectPool: Pointer // ID3D10EffectPool** out
): Integer; stdcall;
external 'd3d10.dll' name 'D3D10CreateEffectPoolFromMemory';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "D3D10CreateEffectPoolFromMemory"
c_D3D10CreateEffectPoolFromMemory :: Ptr () -> CUIntPtr -> Word32 -> Ptr () -> Ptr () -> IO Int32
-- pData : void* -> Ptr ()
-- DataLength : UINT_PTR -> CUIntPtr
-- FXFlags : DWORD -> Word32
-- pDevice : ID3D10Device* -> Ptr ()
-- ppEffectPool : ID3D10EffectPool** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let d3d10createeffectpoolfrommemory =
foreign "D3D10CreateEffectPoolFromMemory"
((ptr void) @-> size_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pData : void* -> (ptr void) *)
(* DataLength : UINT_PTR -> size_t *)
(* FXFlags : DWORD -> uint32_t *)
(* pDevice : ID3D10Device* -> (ptr void) *)
(* ppEffectPool : ID3D10EffectPool** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library d3d10 (t "d3d10.dll"))
(cffi:use-foreign-library d3d10)
(cffi:defcfun ("D3D10CreateEffectPoolFromMemory" d3-d10-create-effect-pool-from-memory :convention :stdcall) :int32
(p-data :pointer) ; void*
(data-length :uint64) ; UINT_PTR
(fxflags :uint32) ; DWORD
(p-device :pointer) ; ID3D10Device*
(pp-effect-pool :pointer)) ; ID3D10EffectPool** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $D3D10CreateEffectPoolFromMemory = Win32::API::More->new('d3d10',
'int D3D10CreateEffectPoolFromMemory(LPVOID pData, WPARAM DataLength, DWORD FXFlags, LPVOID pDevice, LPVOID ppEffectPool)');
# my $ret = $D3D10CreateEffectPoolFromMemory->Call($pData, $DataLength, $FXFlags, $pDevice, $ppEffectPool);
# pData : void* -> LPVOID
# DataLength : UINT_PTR -> WPARAM
# FXFlags : DWORD -> DWORD
# pDevice : ID3D10Device* -> LPVOID
# ppEffectPool : ID3D10EffectPool** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。