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

D3DFINDDEVICESEARCH

構造体
サイズx64: 92 バイト / x86: 92 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0本構造体のサイズ(バイト単位)。
dwFlagsDWORD4+4+4どの検索条件が有効かを示すフラグ群。
bHardwareBOOL4+8+8ハードウェアデバイスを検索するかを示すBOOL。
dcmColorModelDWORD4+12+12検索対象のカラーモデルを示す値。
guidGUID16+16+16検索対象デバイスのGUID。
dwCapsDWORD4+32+32検索対象のケイパビリティフラグ群。
dpcPrimCapsD3DPRIMCAPS56+36+36検索対象のプリミティブケイパビリティ(D3DPRIMCAPS)。

各言語での定義

#include <windows.h>

// D3DPRIMCAPS  (x64 56 / x86 56 バイト)
typedef struct D3DPRIMCAPS {
    DWORD dwSize;
    DWORD dwMiscCaps;
    DWORD dwRasterCaps;
    DWORD dwZCmpCaps;
    DWORD dwSrcBlendCaps;
    DWORD dwDestBlendCaps;
    DWORD dwAlphaCmpCaps;
    DWORD dwShadeCaps;
    DWORD dwTextureCaps;
    DWORD dwTextureFilterCaps;
    DWORD dwTextureBlendCaps;
    DWORD dwTextureAddressCaps;
    DWORD dwStippleWidth;
    DWORD dwStippleHeight;
} D3DPRIMCAPS;

// D3DFINDDEVICESEARCH  (x64 92 / x86 92 バイト)
typedef struct D3DFINDDEVICESEARCH {
    DWORD dwSize;
    DWORD dwFlags;
    BOOL bHardware;
    DWORD dcmColorModel;
    GUID guid;
    DWORD dwCaps;
    D3DPRIMCAPS dpcPrimCaps;
} D3DFINDDEVICESEARCH;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DPRIMCAPS
{
    public uint dwSize;
    public uint dwMiscCaps;
    public uint dwRasterCaps;
    public uint dwZCmpCaps;
    public uint dwSrcBlendCaps;
    public uint dwDestBlendCaps;
    public uint dwAlphaCmpCaps;
    public uint dwShadeCaps;
    public uint dwTextureCaps;
    public uint dwTextureFilterCaps;
    public uint dwTextureBlendCaps;
    public uint dwTextureAddressCaps;
    public uint dwStippleWidth;
    public uint dwStippleHeight;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DFINDDEVICESEARCH
{
    public uint dwSize;
    public uint dwFlags;
    [MarshalAs(UnmanagedType.Bool)] public bool bHardware;
    public uint dcmColorModel;
    public Guid guid;
    public uint dwCaps;
    public D3DPRIMCAPS dpcPrimCaps;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DPRIMCAPS
    Public dwSize As UInteger
    Public dwMiscCaps As UInteger
    Public dwRasterCaps As UInteger
    Public dwZCmpCaps As UInteger
    Public dwSrcBlendCaps As UInteger
    Public dwDestBlendCaps As UInteger
    Public dwAlphaCmpCaps As UInteger
    Public dwShadeCaps As UInteger
    Public dwTextureCaps As UInteger
    Public dwTextureFilterCaps As UInteger
    Public dwTextureBlendCaps As UInteger
    Public dwTextureAddressCaps As UInteger
    Public dwStippleWidth As UInteger
    Public dwStippleHeight As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DFINDDEVICESEARCH
    Public dwSize As UInteger
    Public dwFlags As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public bHardware As Boolean
    Public dcmColorModel As UInteger
    Public guid As Guid
    Public dwCaps As UInteger
    Public dpcPrimCaps As D3DPRIMCAPS
End Structure
import ctypes
from ctypes import wintypes

class D3DPRIMCAPS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwMiscCaps", wintypes.DWORD),
        ("dwRasterCaps", wintypes.DWORD),
        ("dwZCmpCaps", wintypes.DWORD),
        ("dwSrcBlendCaps", wintypes.DWORD),
        ("dwDestBlendCaps", wintypes.DWORD),
        ("dwAlphaCmpCaps", wintypes.DWORD),
        ("dwShadeCaps", wintypes.DWORD),
        ("dwTextureCaps", wintypes.DWORD),
        ("dwTextureFilterCaps", wintypes.DWORD),
        ("dwTextureBlendCaps", wintypes.DWORD),
        ("dwTextureAddressCaps", wintypes.DWORD),
        ("dwStippleWidth", wintypes.DWORD),
        ("dwStippleHeight", wintypes.DWORD),
    ]

class D3DFINDDEVICESEARCH(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("bHardware", wintypes.BOOL),
        ("dcmColorModel", wintypes.DWORD),
        ("guid", GUID),
        ("dwCaps", wintypes.DWORD),
        ("dpcPrimCaps", D3DPRIMCAPS),
    ]
#[repr(C)]
pub struct D3DPRIMCAPS {
    pub dwSize: u32,
    pub dwMiscCaps: u32,
    pub dwRasterCaps: u32,
    pub dwZCmpCaps: u32,
    pub dwSrcBlendCaps: u32,
    pub dwDestBlendCaps: u32,
    pub dwAlphaCmpCaps: u32,
    pub dwShadeCaps: u32,
    pub dwTextureCaps: u32,
    pub dwTextureFilterCaps: u32,
    pub dwTextureBlendCaps: u32,
    pub dwTextureAddressCaps: u32,
    pub dwStippleWidth: u32,
    pub dwStippleHeight: u32,
}

#[repr(C)]
pub struct D3DFINDDEVICESEARCH {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub bHardware: i32,
    pub dcmColorModel: u32,
    pub guid: GUID,
    pub dwCaps: u32,
    pub dpcPrimCaps: D3DPRIMCAPS,
}
import "golang.org/x/sys/windows"

type D3DPRIMCAPS struct {
	dwSize uint32
	dwMiscCaps uint32
	dwRasterCaps uint32
	dwZCmpCaps uint32
	dwSrcBlendCaps uint32
	dwDestBlendCaps uint32
	dwAlphaCmpCaps uint32
	dwShadeCaps uint32
	dwTextureCaps uint32
	dwTextureFilterCaps uint32
	dwTextureBlendCaps uint32
	dwTextureAddressCaps uint32
	dwStippleWidth uint32
	dwStippleHeight uint32
}

type D3DFINDDEVICESEARCH struct {
	dwSize uint32
	dwFlags uint32
	bHardware int32
	dcmColorModel uint32
	guid windows.GUID
	dwCaps uint32
	dpcPrimCaps D3DPRIMCAPS
}
type
  D3DPRIMCAPS = record
    dwSize: DWORD;
    dwMiscCaps: DWORD;
    dwRasterCaps: DWORD;
    dwZCmpCaps: DWORD;
    dwSrcBlendCaps: DWORD;
    dwDestBlendCaps: DWORD;
    dwAlphaCmpCaps: DWORD;
    dwShadeCaps: DWORD;
    dwTextureCaps: DWORD;
    dwTextureFilterCaps: DWORD;
    dwTextureBlendCaps: DWORD;
    dwTextureAddressCaps: DWORD;
    dwStippleWidth: DWORD;
    dwStippleHeight: DWORD;
  end;

  D3DFINDDEVICESEARCH = record
    dwSize: DWORD;
    dwFlags: DWORD;
    bHardware: BOOL;
    dcmColorModel: DWORD;
    guid: TGUID;
    dwCaps: DWORD;
    dpcPrimCaps: D3DPRIMCAPS;
  end;
const D3DPRIMCAPS = extern struct {
    dwSize: u32,
    dwMiscCaps: u32,
    dwRasterCaps: u32,
    dwZCmpCaps: u32,
    dwSrcBlendCaps: u32,
    dwDestBlendCaps: u32,
    dwAlphaCmpCaps: u32,
    dwShadeCaps: u32,
    dwTextureCaps: u32,
    dwTextureFilterCaps: u32,
    dwTextureBlendCaps: u32,
    dwTextureAddressCaps: u32,
    dwStippleWidth: u32,
    dwStippleHeight: u32,
};

const D3DFINDDEVICESEARCH = extern struct {
    dwSize: u32,
    dwFlags: u32,
    bHardware: i32,
    dcmColorModel: u32,
    guid: GUID,
    dwCaps: u32,
    dpcPrimCaps: D3DPRIMCAPS,
};
type
  D3DPRIMCAPS {.bycopy.} = object
    dwSize: uint32
    dwMiscCaps: uint32
    dwRasterCaps: uint32
    dwZCmpCaps: uint32
    dwSrcBlendCaps: uint32
    dwDestBlendCaps: uint32
    dwAlphaCmpCaps: uint32
    dwShadeCaps: uint32
    dwTextureCaps: uint32
    dwTextureFilterCaps: uint32
    dwTextureBlendCaps: uint32
    dwTextureAddressCaps: uint32
    dwStippleWidth: uint32
    dwStippleHeight: uint32

  D3DFINDDEVICESEARCH {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    bHardware: int32
    dcmColorModel: uint32
    guid: GUID
    dwCaps: uint32
    dpcPrimCaps: D3DPRIMCAPS
struct D3DPRIMCAPS
{
    uint dwSize;
    uint dwMiscCaps;
    uint dwRasterCaps;
    uint dwZCmpCaps;
    uint dwSrcBlendCaps;
    uint dwDestBlendCaps;
    uint dwAlphaCmpCaps;
    uint dwShadeCaps;
    uint dwTextureCaps;
    uint dwTextureFilterCaps;
    uint dwTextureBlendCaps;
    uint dwTextureAddressCaps;
    uint dwStippleWidth;
    uint dwStippleHeight;
}

struct D3DFINDDEVICESEARCH
{
    uint dwSize;
    uint dwFlags;
    int bHardware;
    uint dcmColorModel;
    GUID guid;
    uint dwCaps;
    D3DPRIMCAPS dpcPrimCaps;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DFINDDEVICESEARCH サイズ: 92 バイト(x64)
dim st, 23    ; 4byte整数×23(構造体サイズ 92 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; bHardware : BOOL (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dcmColorModel : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; guid : GUID (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; dwCaps : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dpcPrimCaps : D3DPRIMCAPS (+36, 56byte)  varptr(st)+36 を基点に操作(56byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global D3DPRIMCAPS
    #field int dwSize
    #field int dwMiscCaps
    #field int dwRasterCaps
    #field int dwZCmpCaps
    #field int dwSrcBlendCaps
    #field int dwDestBlendCaps
    #field int dwAlphaCmpCaps
    #field int dwShadeCaps
    #field int dwTextureCaps
    #field int dwTextureFilterCaps
    #field int dwTextureBlendCaps
    #field int dwTextureAddressCaps
    #field int dwStippleWidth
    #field int dwStippleHeight
#endstruct

#defstruct global D3DFINDDEVICESEARCH
    #field int dwSize
    #field int dwFlags
    #field bool bHardware
    #field int dcmColorModel
    #field GUID guid
    #field int dwCaps
    #field D3DPRIMCAPS dpcPrimCaps
#endstruct

stdim st, D3DFINDDEVICESEARCH        ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize