ホーム › Graphics.Direct3D12 › D3D12EnableExperimentalFeatures
D3D12EnableExperimentalFeatures
関数デバイス作成前にDirect3D12の実験的機能を有効化する。
シグネチャ
// d3d12.dll
#include <windows.h>
HRESULT D3D12EnableExperimentalFeatures(
DWORD NumFeatures,
const GUID* pIIDs,
void* pConfigurationStructs, // optional
DWORD* pConfigurationStructSizes // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| NumFeatures | DWORD | in | 有効化する実験的機能の個数を指定する。 |
| pIIDs | GUID* | in | 有効化する各実験的機能を識別するGUIDの配列。 |
| pConfigurationStructs | void* | inoptional | 各機能の構成構造体の配列へのポインター。不要ならNULL。 |
| pConfigurationStructSizes | DWORD* | inoptional | 各構成構造体のバイトサイズを格納した配列。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// d3d12.dll
#include <windows.h>
HRESULT D3D12EnableExperimentalFeatures(
DWORD NumFeatures,
const GUID* pIIDs,
void* pConfigurationStructs, // optional
DWORD* pConfigurationStructSizes // optional
);[DllImport("d3d12.dll", ExactSpelling = true)]
static extern int D3D12EnableExperimentalFeatures(
uint NumFeatures, // DWORD
ref Guid pIIDs, // GUID*
IntPtr pConfigurationStructs, // void* optional
IntPtr pConfigurationStructSizes // DWORD* optional
);<DllImport("d3d12.dll", ExactSpelling:=True)>
Public Shared Function D3D12EnableExperimentalFeatures(
NumFeatures As UInteger, ' DWORD
ByRef pIIDs As Guid, ' GUID*
pConfigurationStructs As IntPtr, ' void* optional
pConfigurationStructSizes As IntPtr ' DWORD* optional
) As Integer
End Function' NumFeatures : DWORD
' pIIDs : GUID*
' pConfigurationStructs : void* optional
' pConfigurationStructSizes : DWORD* optional
Declare PtrSafe Function D3D12EnableExperimentalFeatures Lib "d3d12" ( _
ByVal NumFeatures As Long, _
ByVal pIIDs As LongPtr, _
ByVal pConfigurationStructs As LongPtr, _
ByVal pConfigurationStructSizes As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
D3D12EnableExperimentalFeatures = ctypes.windll.d3d12.D3D12EnableExperimentalFeatures
D3D12EnableExperimentalFeatures.restype = ctypes.c_int
D3D12EnableExperimentalFeatures.argtypes = [
wintypes.DWORD, # NumFeatures : DWORD
ctypes.c_void_p, # pIIDs : GUID*
ctypes.POINTER(None), # pConfigurationStructs : void* optional
ctypes.POINTER(wintypes.DWORD), # pConfigurationStructSizes : DWORD* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('d3d12.dll')
D3D12EnableExperimentalFeatures = Fiddle::Function.new(
lib['D3D12EnableExperimentalFeatures'],
[
-Fiddle::TYPE_INT, # NumFeatures : DWORD
Fiddle::TYPE_VOIDP, # pIIDs : GUID*
Fiddle::TYPE_VOIDP, # pConfigurationStructs : void* optional
Fiddle::TYPE_VOIDP, # pConfigurationStructSizes : DWORD* optional
],
Fiddle::TYPE_INT)#[link(name = "d3d12")]
extern "system" {
fn D3D12EnableExperimentalFeatures(
NumFeatures: u32, // DWORD
pIIDs: *const GUID, // GUID*
pConfigurationStructs: *mut (), // void* optional
pConfigurationStructSizes: *mut u32 // DWORD* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("d3d12.dll")]
public static extern int D3D12EnableExperimentalFeatures(uint NumFeatures, ref Guid pIIDs, IntPtr pConfigurationStructs, IntPtr pConfigurationStructSizes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'd3d12_D3D12EnableExperimentalFeatures' -Namespace Win32 -PassThru
# $api::D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes)#uselib "d3d12.dll"
#func global D3D12EnableExperimentalFeatures "D3D12EnableExperimentalFeatures" sptr, sptr, sptr, sptr
; D3D12EnableExperimentalFeatures NumFeatures, varptr(pIIDs), pConfigurationStructs, varptr(pConfigurationStructSizes) ; 戻り値は stat
; NumFeatures : DWORD -> "sptr"
; pIIDs : GUID* -> "sptr"
; pConfigurationStructs : void* optional -> "sptr"
; pConfigurationStructSizes : DWORD* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "d3d12.dll" #cfunc global D3D12EnableExperimentalFeatures "D3D12EnableExperimentalFeatures" int, var, sptr, var ; res = D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes) ; NumFeatures : DWORD -> "int" ; pIIDs : GUID* -> "var" ; pConfigurationStructs : void* optional -> "sptr" ; pConfigurationStructSizes : DWORD* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "d3d12.dll" #cfunc global D3D12EnableExperimentalFeatures "D3D12EnableExperimentalFeatures" int, sptr, sptr, sptr ; res = D3D12EnableExperimentalFeatures(NumFeatures, varptr(pIIDs), pConfigurationStructs, varptr(pConfigurationStructSizes)) ; NumFeatures : DWORD -> "int" ; pIIDs : GUID* -> "sptr" ; pConfigurationStructs : void* optional -> "sptr" ; pConfigurationStructSizes : DWORD* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT D3D12EnableExperimentalFeatures(DWORD NumFeatures, GUID* pIIDs, void* pConfigurationStructs, DWORD* pConfigurationStructSizes) #uselib "d3d12.dll" #cfunc global D3D12EnableExperimentalFeatures "D3D12EnableExperimentalFeatures" int, var, intptr, var ; res = D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes) ; NumFeatures : DWORD -> "int" ; pIIDs : GUID* -> "var" ; pConfigurationStructs : void* optional -> "intptr" ; pConfigurationStructSizes : DWORD* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT D3D12EnableExperimentalFeatures(DWORD NumFeatures, GUID* pIIDs, void* pConfigurationStructs, DWORD* pConfigurationStructSizes) #uselib "d3d12.dll" #cfunc global D3D12EnableExperimentalFeatures "D3D12EnableExperimentalFeatures" int, intptr, intptr, intptr ; res = D3D12EnableExperimentalFeatures(NumFeatures, varptr(pIIDs), pConfigurationStructs, varptr(pConfigurationStructSizes)) ; NumFeatures : DWORD -> "int" ; pIIDs : GUID* -> "intptr" ; pConfigurationStructs : void* optional -> "intptr" ; pConfigurationStructSizes : DWORD* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
d3d12 = windows.NewLazySystemDLL("d3d12.dll")
procD3D12EnableExperimentalFeatures = d3d12.NewProc("D3D12EnableExperimentalFeatures")
)
// NumFeatures (DWORD), pIIDs (GUID*), pConfigurationStructs (void* optional), pConfigurationStructSizes (DWORD* optional)
r1, _, err := procD3D12EnableExperimentalFeatures.Call(
uintptr(NumFeatures),
uintptr(pIIDs),
uintptr(pConfigurationStructs),
uintptr(pConfigurationStructSizes),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction D3D12EnableExperimentalFeatures(
NumFeatures: DWORD; // DWORD
pIIDs: PGUID; // GUID*
pConfigurationStructs: Pointer; // void* optional
pConfigurationStructSizes: Pointer // DWORD* optional
): Integer; stdcall;
external 'd3d12.dll' name 'D3D12EnableExperimentalFeatures';result := DllCall("d3d12\D3D12EnableExperimentalFeatures"
, "UInt", NumFeatures ; DWORD
, "Ptr", pIIDs ; GUID*
, "Ptr", pConfigurationStructs ; void* optional
, "Ptr", pConfigurationStructSizes ; DWORD* optional
, "Int") ; return: HRESULT●D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes) = DLL("d3d12.dll", "int D3D12EnableExperimentalFeatures(dword, void*, void*, void*)")
# 呼び出し: D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes)
# NumFeatures : DWORD -> "dword"
# pIIDs : GUID* -> "void*"
# pConfigurationStructs : void* optional -> "void*"
# pConfigurationStructSizes : DWORD* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "d3d12" fn D3D12EnableExperimentalFeatures(
NumFeatures: u32, // DWORD
pIIDs: [*c]GUID, // GUID*
pConfigurationStructs: ?*anyopaque, // void* optional
pConfigurationStructSizes: [*c]u32 // DWORD* optional
) callconv(std.os.windows.WINAPI) i32;proc D3D12EnableExperimentalFeatures(
NumFeatures: uint32, # DWORD
pIIDs: ptr GUID, # GUID*
pConfigurationStructs: pointer, # void* optional
pConfigurationStructSizes: ptr uint32 # DWORD* optional
): int32 {.importc: "D3D12EnableExperimentalFeatures", stdcall, dynlib: "d3d12.dll".}pragma(lib, "d3d12");
extern(Windows)
int D3D12EnableExperimentalFeatures(
uint NumFeatures, // DWORD
GUID* pIIDs, // GUID*
void* pConfigurationStructs, // void* optional
uint* pConfigurationStructSizes // DWORD* optional
);ccall((:D3D12EnableExperimentalFeatures, "d3d12.dll"), stdcall, Int32,
(UInt32, Ptr{GUID}, Ptr{Cvoid}, Ptr{UInt32}),
NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes)
# NumFeatures : DWORD -> UInt32
# pIIDs : GUID* -> Ptr{GUID}
# pConfigurationStructs : void* optional -> Ptr{Cvoid}
# pConfigurationStructSizes : DWORD* optional -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t D3D12EnableExperimentalFeatures(
uint32_t NumFeatures,
void* pIIDs,
void* pConfigurationStructs,
uint32_t* pConfigurationStructSizes);
]]
local d3d12 = ffi.load("d3d12")
-- d3d12.D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes)
-- NumFeatures : DWORD
-- pIIDs : GUID*
-- pConfigurationStructs : void* optional
-- pConfigurationStructSizes : DWORD* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('d3d12.dll');
const D3D12EnableExperimentalFeatures = lib.func('__stdcall', 'D3D12EnableExperimentalFeatures', 'int32_t', ['uint32_t', 'void *', 'void *', 'uint32_t *']);
// D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes)
// NumFeatures : DWORD -> 'uint32_t'
// pIIDs : GUID* -> 'void *'
// pConfigurationStructs : void* optional -> 'void *'
// pConfigurationStructSizes : DWORD* optional -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("d3d12.dll", {
D3D12EnableExperimentalFeatures: { parameters: ["u32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes)
// NumFeatures : DWORD -> "u32"
// pIIDs : GUID* -> "pointer"
// pConfigurationStructs : void* optional -> "pointer"
// pConfigurationStructSizes : DWORD* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t D3D12EnableExperimentalFeatures(
uint32_t NumFeatures,
void* pIIDs,
void* pConfigurationStructs,
uint32_t* pConfigurationStructSizes);
C, "d3d12.dll");
// $ffi->D3D12EnableExperimentalFeatures(NumFeatures, pIIDs, pConfigurationStructs, pConfigurationStructSizes);
// NumFeatures : DWORD
// pIIDs : GUID*
// pConfigurationStructs : void* optional
// pConfigurationStructSizes : DWORD* optional
// 構造体/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 D3d12 extends StdCallLibrary {
D3d12 INSTANCE = Native.load("d3d12", D3d12.class);
int D3D12EnableExperimentalFeatures(
int NumFeatures, // DWORD
Pointer pIIDs, // GUID*
Pointer pConfigurationStructs, // void* optional
IntByReference pConfigurationStructSizes // DWORD* optional
);
}@[Link("d3d12")]
lib Libd3d12
fun D3D12EnableExperimentalFeatures = D3D12EnableExperimentalFeatures(
NumFeatures : UInt32, # DWORD
pIIDs : GUID*, # GUID*
pConfigurationStructs : Void*, # void* optional
pConfigurationStructSizes : UInt32* # DWORD* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef D3D12EnableExperimentalFeaturesNative = Int32 Function(Uint32, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef D3D12EnableExperimentalFeaturesDart = int Function(int, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final D3D12EnableExperimentalFeatures = DynamicLibrary.open('d3d12.dll')
.lookupFunction<D3D12EnableExperimentalFeaturesNative, D3D12EnableExperimentalFeaturesDart>('D3D12EnableExperimentalFeatures');
// NumFeatures : DWORD -> Uint32
// pIIDs : GUID* -> Pointer<Void>
// pConfigurationStructs : void* optional -> Pointer<Void>
// pConfigurationStructSizes : DWORD* optional -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function D3D12EnableExperimentalFeatures(
NumFeatures: DWORD; // DWORD
pIIDs: PGUID; // GUID*
pConfigurationStructs: Pointer; // void* optional
pConfigurationStructSizes: Pointer // DWORD* optional
): Integer; stdcall;
external 'd3d12.dll' name 'D3D12EnableExperimentalFeatures';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "D3D12EnableExperimentalFeatures"
c_D3D12EnableExperimentalFeatures :: Word32 -> Ptr () -> Ptr () -> Ptr Word32 -> IO Int32
-- NumFeatures : DWORD -> Word32
-- pIIDs : GUID* -> Ptr ()
-- pConfigurationStructs : void* optional -> Ptr ()
-- pConfigurationStructSizes : DWORD* optional -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let d3d12enableexperimentalfeatures =
foreign "D3D12EnableExperimentalFeatures"
(uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* NumFeatures : DWORD -> uint32_t *)
(* pIIDs : GUID* -> (ptr void) *)
(* pConfigurationStructs : void* optional -> (ptr void) *)
(* pConfigurationStructSizes : DWORD* optional -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library d3d12 (t "d3d12.dll"))
(cffi:use-foreign-library d3d12)
(cffi:defcfun ("D3D12EnableExperimentalFeatures" d3-d12-enable-experimental-features :convention :stdcall) :int32
(num-features :uint32) ; DWORD
(p-iids :pointer) ; GUID*
(p-configuration-structs :pointer) ; void* optional
(p-configuration-struct-sizes :pointer)) ; DWORD* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $D3D12EnableExperimentalFeatures = Win32::API::More->new('d3d12',
'int D3D12EnableExperimentalFeatures(DWORD NumFeatures, LPVOID pIIDs, LPVOID pConfigurationStructs, LPVOID pConfigurationStructSizes)');
# my $ret = $D3D12EnableExperimentalFeatures->Call($NumFeatures, $pIIDs, $pConfigurationStructs, $pConfigurationStructSizes);
# NumFeatures : DWORD -> DWORD
# pIIDs : GUID* -> LPVOID
# pConfigurationStructs : void* optional -> LPVOID
# pConfigurationStructSizes : DWORD* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。