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