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

D3D10CreateEffectFromMemory

関数
メモリ上のコンパイル済みエフェクトからエフェクトオブジェクトを作成する。
DLLd3d10.dll呼出規約winapi

シグネチャ

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

HRESULT D3D10CreateEffectFromMemory(
    void* pData,
    UINT_PTR DataLength,
    DWORD FXFlags,
    ID3D10Device* pDevice,
    ID3D10EffectPool* pEffectPool,   // optional
    ID3D10Effect** ppEffect
);

パラメーター

名前方向説明
pDatavoid*inコンパイル済みエフェクトデータの先頭ポインター。
DataLengthUINT_PTRinpDataが指すエフェクトデータのバイト数を指定する。
FXFlagsDWORDinエフェクト生成を制御するD3D10_EFFECT系フラグの組み合わせ。
pDeviceID3D10Device*inエフェクトを関連付ける対象のID3D10Device。
pEffectPoolID3D10EffectPool*inoptional共有変数のエフェクトプール。共有不要ならNULL。
ppEffectID3D10Effect**out生成されたID3D10Effectを受け取る出力先。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT D3D10CreateEffectFromMemory(
    void* pData,
    UINT_PTR DataLength,
    DWORD FXFlags,
    ID3D10Device* pDevice,
    ID3D10EffectPool* pEffectPool,   // optional
    ID3D10Effect** ppEffect
);
[DllImport("d3d10.dll", ExactSpelling = true)]
static extern int D3D10CreateEffectFromMemory(
    IntPtr pData,   // void*
    UIntPtr DataLength,   // UINT_PTR
    uint FXFlags,   // DWORD
    IntPtr pDevice,   // ID3D10Device*
    IntPtr pEffectPool,   // ID3D10EffectPool* optional
    IntPtr ppEffect   // ID3D10Effect** out
);
<DllImport("d3d10.dll", ExactSpelling:=True)>
Public Shared Function D3D10CreateEffectFromMemory(
    pData As IntPtr,   ' void*
    DataLength As UIntPtr,   ' UINT_PTR
    FXFlags As UInteger,   ' DWORD
    pDevice As IntPtr,   ' ID3D10Device*
    pEffectPool As IntPtr,   ' ID3D10EffectPool* optional
    ppEffect As IntPtr   ' ID3D10Effect** out
) As Integer
End Function
' pData : void*
' DataLength : UINT_PTR
' FXFlags : DWORD
' pDevice : ID3D10Device*
' pEffectPool : ID3D10EffectPool* optional
' ppEffect : ID3D10Effect** out
Declare PtrSafe Function D3D10CreateEffectFromMemory Lib "d3d10" ( _
    ByVal pData As LongPtr, _
    ByVal DataLength As LongPtr, _
    ByVal FXFlags As Long, _
    ByVal pDevice As LongPtr, _
    ByVal pEffectPool As LongPtr, _
    ByVal ppEffect As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

D3D10CreateEffectFromMemory = ctypes.windll.d3d10.D3D10CreateEffectFromMemory
D3D10CreateEffectFromMemory.restype = ctypes.c_int
D3D10CreateEffectFromMemory.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,  # pEffectPool : ID3D10EffectPool* optional
    ctypes.c_void_p,  # ppEffect : ID3D10Effect** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('d3d10.dll')
D3D10CreateEffectFromMemory = Fiddle::Function.new(
  lib['D3D10CreateEffectFromMemory'],
  [
    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,  # pEffectPool : ID3D10EffectPool* optional
    Fiddle::TYPE_VOIDP,  # ppEffect : ID3D10Effect** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "d3d10")]
extern "system" {
    fn D3D10CreateEffectFromMemory(
        pData: *mut (),  // void*
        DataLength: usize,  // UINT_PTR
        FXFlags: u32,  // DWORD
        pDevice: *mut core::ffi::c_void,  // ID3D10Device*
        pEffectPool: *mut core::ffi::c_void,  // ID3D10EffectPool* optional
        ppEffect: *mut *mut core::ffi::c_void  // ID3D10Effect** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("d3d10.dll")]
public static extern int D3D10CreateEffectFromMemory(IntPtr pData, UIntPtr DataLength, uint FXFlags, IntPtr pDevice, IntPtr pEffectPool, IntPtr ppEffect);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d10_D3D10CreateEffectFromMemory' -Namespace Win32 -PassThru
# $api::D3D10CreateEffectFromMemory(pData, DataLength, FXFlags, pDevice, pEffectPool, ppEffect)
#uselib "d3d10.dll"
#func global D3D10CreateEffectFromMemory "D3D10CreateEffectFromMemory" sptr, sptr, sptr, sptr, sptr, sptr
; D3D10CreateEffectFromMemory pData, DataLength, FXFlags, pDevice, pEffectPool, ppEffect   ; 戻り値は stat
; pData : void* -> "sptr"
; DataLength : UINT_PTR -> "sptr"
; FXFlags : DWORD -> "sptr"
; pDevice : ID3D10Device* -> "sptr"
; pEffectPool : ID3D10EffectPool* optional -> "sptr"
; ppEffect : ID3D10Effect** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "d3d10.dll"
#cfunc global D3D10CreateEffectFromMemory "D3D10CreateEffectFromMemory" sptr, sptr, int, sptr, sptr, sptr
; res = D3D10CreateEffectFromMemory(pData, DataLength, FXFlags, pDevice, pEffectPool, ppEffect)
; pData : void* -> "sptr"
; DataLength : UINT_PTR -> "sptr"
; FXFlags : DWORD -> "int"
; pDevice : ID3D10Device* -> "sptr"
; pEffectPool : ID3D10EffectPool* optional -> "sptr"
; ppEffect : ID3D10Effect** out -> "sptr"
; HRESULT D3D10CreateEffectFromMemory(void* pData, UINT_PTR DataLength, DWORD FXFlags, ID3D10Device* pDevice, ID3D10EffectPool* pEffectPool, ID3D10Effect** ppEffect)
#uselib "d3d10.dll"
#cfunc global D3D10CreateEffectFromMemory "D3D10CreateEffectFromMemory" intptr, intptr, int, intptr, intptr, intptr
; res = D3D10CreateEffectFromMemory(pData, DataLength, FXFlags, pDevice, pEffectPool, ppEffect)
; pData : void* -> "intptr"
; DataLength : UINT_PTR -> "intptr"
; FXFlags : DWORD -> "int"
; pDevice : ID3D10Device* -> "intptr"
; pEffectPool : ID3D10EffectPool* optional -> "intptr"
; ppEffect : ID3D10Effect** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	d3d10 = windows.NewLazySystemDLL("d3d10.dll")
	procD3D10CreateEffectFromMemory = d3d10.NewProc("D3D10CreateEffectFromMemory")
)

// pData (void*), DataLength (UINT_PTR), FXFlags (DWORD), pDevice (ID3D10Device*), pEffectPool (ID3D10EffectPool* optional), ppEffect (ID3D10Effect** out)
r1, _, err := procD3D10CreateEffectFromMemory.Call(
	uintptr(pData),
	uintptr(DataLength),
	uintptr(FXFlags),
	uintptr(pDevice),
	uintptr(pEffectPool),
	uintptr(ppEffect),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function D3D10CreateEffectFromMemory(
  pData: Pointer;   // void*
  DataLength: NativeUInt;   // UINT_PTR
  FXFlags: DWORD;   // DWORD
  pDevice: Pointer;   // ID3D10Device*
  pEffectPool: Pointer;   // ID3D10EffectPool* optional
  ppEffect: Pointer   // ID3D10Effect** out
): Integer; stdcall;
  external 'd3d10.dll' name 'D3D10CreateEffectFromMemory';
result := DllCall("d3d10\D3D10CreateEffectFromMemory"
    , "Ptr", pData   ; void*
    , "UPtr", DataLength   ; UINT_PTR
    , "UInt", FXFlags   ; DWORD
    , "Ptr", pDevice   ; ID3D10Device*
    , "Ptr", pEffectPool   ; ID3D10EffectPool* optional
    , "Ptr", ppEffect   ; ID3D10Effect** out
    , "Int")   ; return: HRESULT
●D3D10CreateEffectFromMemory(pData, DataLength, FXFlags, pDevice, pEffectPool, ppEffect) = DLL("d3d10.dll", "int D3D10CreateEffectFromMemory(void*, int, dword, void*, void*, void*)")
# 呼び出し: D3D10CreateEffectFromMemory(pData, DataLength, FXFlags, pDevice, pEffectPool, ppEffect)
# pData : void* -> "void*"
# DataLength : UINT_PTR -> "int"
# FXFlags : DWORD -> "dword"
# pDevice : ID3D10Device* -> "void*"
# pEffectPool : ID3D10EffectPool* optional -> "void*"
# ppEffect : ID3D10Effect** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef D3D10CreateEffectFromMemoryNative = Int32 Function(Pointer<Void>, UintPtr, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef D3D10CreateEffectFromMemoryDart = int Function(Pointer<Void>, int, int, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final D3D10CreateEffectFromMemory = DynamicLibrary.open('d3d10.dll')
    .lookupFunction<D3D10CreateEffectFromMemoryNative, D3D10CreateEffectFromMemoryDart>('D3D10CreateEffectFromMemory');
// pData : void* -> Pointer<Void>
// DataLength : UINT_PTR -> UintPtr
// FXFlags : DWORD -> Uint32
// pDevice : ID3D10Device* -> Pointer<Void>
// pEffectPool : ID3D10EffectPool* optional -> Pointer<Void>
// ppEffect : ID3D10Effect** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function D3D10CreateEffectFromMemory(
  pData: Pointer;   // void*
  DataLength: NativeUInt;   // UINT_PTR
  FXFlags: DWORD;   // DWORD
  pDevice: Pointer;   // ID3D10Device*
  pEffectPool: Pointer;   // ID3D10EffectPool* optional
  ppEffect: Pointer   // ID3D10Effect** out
): Integer; stdcall;
  external 'd3d10.dll' name 'D3D10CreateEffectFromMemory';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "D3D10CreateEffectFromMemory"
  c_D3D10CreateEffectFromMemory :: Ptr () -> CUIntPtr -> Word32 -> Ptr () -> Ptr () -> Ptr () -> IO Int32
-- pData : void* -> Ptr ()
-- DataLength : UINT_PTR -> CUIntPtr
-- FXFlags : DWORD -> Word32
-- pDevice : ID3D10Device* -> Ptr ()
-- pEffectPool : ID3D10EffectPool* optional -> Ptr ()
-- ppEffect : ID3D10Effect** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let d3d10createeffectfrommemory =
  foreign "D3D10CreateEffectFromMemory"
    ((ptr void) @-> size_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pData : void* -> (ptr void) *)
(* DataLength : UINT_PTR -> size_t *)
(* FXFlags : DWORD -> uint32_t *)
(* pDevice : ID3D10Device* -> (ptr void) *)
(* pEffectPool : ID3D10EffectPool* optional -> (ptr void) *)
(* ppEffect : ID3D10Effect** 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 ("D3D10CreateEffectFromMemory" d3-d10-create-effect-from-memory :convention :stdcall) :int32
  (p-data :pointer)   ; void*
  (data-length :uint64)   ; UINT_PTR
  (fxflags :uint32)   ; DWORD
  (p-device :pointer)   ; ID3D10Device*
  (p-effect-pool :pointer)   ; ID3D10EffectPool* optional
  (pp-effect :pointer))   ; ID3D10Effect** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $D3D10CreateEffectFromMemory = Win32::API::More->new('d3d10',
    'int D3D10CreateEffectFromMemory(LPVOID pData, WPARAM DataLength, DWORD FXFlags, LPVOID pDevice, LPVOID pEffectPool, LPVOID ppEffect)');
# my $ret = $D3D10CreateEffectFromMemory->Call($pData, $DataLength, $FXFlags, $pDevice, $pEffectPool, $ppEffect);
# pData : void* -> LPVOID
# DataLength : UINT_PTR -> WPARAM
# FXFlags : DWORD -> DWORD
# pDevice : ID3D10Device* -> LPVOID
# pEffectPool : ID3D10EffectPool* optional -> LPVOID
# ppEffect : ID3D10Effect** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型