ホーム › Graphics.Direct3D10 › D3D10CreateDevice
D3D10CreateDevice
関数Direct3D10デバイスを作成しグラフィックスアダプターを初期化する。
シグネチャ
// d3d10.dll
#include <windows.h>
HRESULT D3D10CreateDevice(
IDXGIAdapter* pAdapter, // optional
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
DWORD Flags,
DWORD SDKVersion,
ID3D10Device** ppDevice // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pAdapter | IDXGIAdapter* | inoptional |
| DriverType | D3D10_DRIVER_TYPE | in |
| Software | HMODULE | in |
| Flags | DWORD | in |
| SDKVersion | DWORD | in |
| ppDevice | ID3D10Device** | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// d3d10.dll
#include <windows.h>
HRESULT D3D10CreateDevice(
IDXGIAdapter* pAdapter, // optional
D3D10_DRIVER_TYPE DriverType,
HMODULE Software,
DWORD Flags,
DWORD SDKVersion,
ID3D10Device** ppDevice // optional
);[DllImport("d3d10.dll", ExactSpelling = true)]
static extern int D3D10CreateDevice(
IntPtr pAdapter, // IDXGIAdapter* optional
int DriverType, // D3D10_DRIVER_TYPE
IntPtr Software, // HMODULE
uint Flags, // DWORD
uint SDKVersion, // DWORD
IntPtr ppDevice // ID3D10Device** optional, out
);<DllImport("d3d10.dll", ExactSpelling:=True)>
Public Shared Function D3D10CreateDevice(
pAdapter As IntPtr, ' IDXGIAdapter* optional
DriverType As Integer, ' D3D10_DRIVER_TYPE
Software As IntPtr, ' HMODULE
Flags As UInteger, ' DWORD
SDKVersion As UInteger, ' DWORD
ppDevice As IntPtr ' ID3D10Device** optional, out
) As Integer
End Function' pAdapter : IDXGIAdapter* optional
' DriverType : D3D10_DRIVER_TYPE
' Software : HMODULE
' Flags : DWORD
' SDKVersion : DWORD
' ppDevice : ID3D10Device** optional, out
Declare PtrSafe Function D3D10CreateDevice Lib "d3d10" ( _
ByVal pAdapter As LongPtr, _
ByVal DriverType As Long, _
ByVal Software As LongPtr, _
ByVal Flags As Long, _
ByVal SDKVersion As Long, _
ByVal ppDevice As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3D10CreateDevice = ctypes.windll.d3d10.D3D10CreateDevice
D3D10CreateDevice.restype = ctypes.c_int
D3D10CreateDevice.argtypes = [
ctypes.c_void_p, # pAdapter : IDXGIAdapter* optional
ctypes.c_int, # DriverType : D3D10_DRIVER_TYPE
wintypes.HANDLE, # Software : HMODULE
wintypes.DWORD, # Flags : DWORD
wintypes.DWORD, # SDKVersion : DWORD
ctypes.c_void_p, # ppDevice : ID3D10Device** optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('d3d10.dll')
D3D10CreateDevice = Fiddle::Function.new(
lib['D3D10CreateDevice'],
[
Fiddle::TYPE_VOIDP, # pAdapter : IDXGIAdapter* optional
Fiddle::TYPE_INT, # DriverType : D3D10_DRIVER_TYPE
Fiddle::TYPE_VOIDP, # Software : HMODULE
-Fiddle::TYPE_INT, # Flags : DWORD
-Fiddle::TYPE_INT, # SDKVersion : DWORD
Fiddle::TYPE_VOIDP, # ppDevice : ID3D10Device** optional, out
],
Fiddle::TYPE_INT)#[link(name = "d3d10")]
extern "system" {
fn D3D10CreateDevice(
pAdapter: *mut core::ffi::c_void, // IDXGIAdapter* optional
DriverType: i32, // D3D10_DRIVER_TYPE
Software: *mut core::ffi::c_void, // HMODULE
Flags: u32, // DWORD
SDKVersion: u32, // DWORD
ppDevice: *mut *mut core::ffi::c_void // ID3D10Device** optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("d3d10.dll")]
public static extern int D3D10CreateDevice(IntPtr pAdapter, int DriverType, IntPtr Software, uint Flags, uint SDKVersion, IntPtr ppDevice);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d10_D3D10CreateDevice' -Namespace Win32 -PassThru
# $api::D3D10CreateDevice(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice)#uselib "d3d10.dll"
#func global D3D10CreateDevice "D3D10CreateDevice" sptr, sptr, sptr, sptr, sptr, sptr
; D3D10CreateDevice pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice ; 戻り値は stat
; pAdapter : IDXGIAdapter* optional -> "sptr"
; DriverType : D3D10_DRIVER_TYPE -> "sptr"
; Software : HMODULE -> "sptr"
; Flags : DWORD -> "sptr"
; SDKVersion : DWORD -> "sptr"
; ppDevice : ID3D10Device** optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "d3d10.dll"
#cfunc global D3D10CreateDevice "D3D10CreateDevice" sptr, int, sptr, int, int, sptr
; res = D3D10CreateDevice(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice)
; pAdapter : IDXGIAdapter* optional -> "sptr"
; DriverType : D3D10_DRIVER_TYPE -> "int"
; Software : HMODULE -> "sptr"
; Flags : DWORD -> "int"
; SDKVersion : DWORD -> "int"
; ppDevice : ID3D10Device** optional, out -> "sptr"; HRESULT D3D10CreateDevice(IDXGIAdapter* pAdapter, D3D10_DRIVER_TYPE DriverType, HMODULE Software, DWORD Flags, DWORD SDKVersion, ID3D10Device** ppDevice)
#uselib "d3d10.dll"
#cfunc global D3D10CreateDevice "D3D10CreateDevice" intptr, int, intptr, int, int, intptr
; res = D3D10CreateDevice(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice)
; pAdapter : IDXGIAdapter* optional -> "intptr"
; DriverType : D3D10_DRIVER_TYPE -> "int"
; Software : HMODULE -> "intptr"
; Flags : DWORD -> "int"
; SDKVersion : DWORD -> "int"
; ppDevice : ID3D10Device** optional, out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3d10 = windows.NewLazySystemDLL("d3d10.dll")
procD3D10CreateDevice = d3d10.NewProc("D3D10CreateDevice")
)
// pAdapter (IDXGIAdapter* optional), DriverType (D3D10_DRIVER_TYPE), Software (HMODULE), Flags (DWORD), SDKVersion (DWORD), ppDevice (ID3D10Device** optional, out)
r1, _, err := procD3D10CreateDevice.Call(
uintptr(pAdapter),
uintptr(DriverType),
uintptr(Software),
uintptr(Flags),
uintptr(SDKVersion),
uintptr(ppDevice),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3D10CreateDevice(
pAdapter: Pointer; // IDXGIAdapter* optional
DriverType: Integer; // D3D10_DRIVER_TYPE
Software: THandle; // HMODULE
Flags: DWORD; // DWORD
SDKVersion: DWORD; // DWORD
ppDevice: Pointer // ID3D10Device** optional, out
): Integer; stdcall;
external 'd3d10.dll' name 'D3D10CreateDevice';result := DllCall("d3d10\D3D10CreateDevice"
, "Ptr", pAdapter ; IDXGIAdapter* optional
, "Int", DriverType ; D3D10_DRIVER_TYPE
, "Ptr", Software ; HMODULE
, "UInt", Flags ; DWORD
, "UInt", SDKVersion ; DWORD
, "Ptr", ppDevice ; ID3D10Device** optional, out
, "Int") ; return: HRESULT●D3D10CreateDevice(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice) = DLL("d3d10.dll", "int D3D10CreateDevice(void*, int, void*, dword, dword, void*)")
# 呼び出し: D3D10CreateDevice(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice)
# pAdapter : IDXGIAdapter* optional -> "void*"
# DriverType : D3D10_DRIVER_TYPE -> "int"
# Software : HMODULE -> "void*"
# Flags : DWORD -> "dword"
# SDKVersion : DWORD -> "dword"
# ppDevice : ID3D10Device** optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。