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

D3DFINDDEVICERESULT

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0本構造体のサイズ(バイト単位)。
guidGUID16+4+4見つかったデバイスのGUID。
ddHwDescD3DDEVICEDESC252+20+20ハードウェアデバイスの記述(D3DDEVICEDESC)。
ddSwDescD3DDEVICEDESC252+272+272ソフトウェアデバイスの記述(D3DDEVICEDESC)。

各言語での定義

#include <windows.h>

// D3DTRANSFORMCAPS  (x64 8 / x86 8 バイト)
typedef struct D3DTRANSFORMCAPS {
    DWORD dwSize;
    DWORD dwCaps;
} D3DTRANSFORMCAPS;

// D3DLIGHTINGCAPS  (x64 16 / x86 16 バイト)
typedef struct D3DLIGHTINGCAPS {
    DWORD dwSize;
    DWORD dwCaps;
    DWORD dwLightingModel;
    DWORD dwNumLights;
} D3DLIGHTINGCAPS;

// 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;

// D3DDEVICEDESC  (x64 252 / x86 252 バイト)
typedef struct D3DDEVICEDESC {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dcmColorModel;
    DWORD dwDevCaps;
    D3DTRANSFORMCAPS dtcTransformCaps;
    BOOL bClipping;
    D3DLIGHTINGCAPS dlcLightingCaps;
    D3DPRIMCAPS dpcLineCaps;
    D3DPRIMCAPS dpcTriCaps;
    DWORD dwDeviceRenderBitDepth;
    DWORD dwDeviceZBufferBitDepth;
    DWORD dwMaxBufferSize;
    DWORD dwMaxVertexCount;
    DWORD dwMinTextureWidth;
    DWORD dwMinTextureHeight;
    DWORD dwMaxTextureWidth;
    DWORD dwMaxTextureHeight;
    DWORD dwMinStippleWidth;
    DWORD dwMaxStippleWidth;
    DWORD dwMinStippleHeight;
    DWORD dwMaxStippleHeight;
    DWORD dwMaxTextureRepeat;
    DWORD dwMaxTextureAspectRatio;
    DWORD dwMaxAnisotropy;
    FLOAT dvGuardBandLeft;
    FLOAT dvGuardBandTop;
    FLOAT dvGuardBandRight;
    FLOAT dvGuardBandBottom;
    FLOAT dvExtentsAdjust;
    DWORD dwStencilCaps;
    DWORD dwFVFCaps;
    DWORD dwTextureOpCaps;
    WORD wMaxTextureBlendStages;
    WORD wMaxSimultaneousTextures;
} D3DDEVICEDESC;

// D3DFINDDEVICERESULT  (x64 524 / x86 524 バイト)
typedef struct D3DFINDDEVICERESULT {
    DWORD dwSize;
    GUID guid;
    D3DDEVICEDESC ddHwDesc;
    D3DDEVICEDESC ddSwDesc;
} D3DFINDDEVICERESULT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DTRANSFORMCAPS
{
    public uint dwSize;
    public uint dwCaps;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DLIGHTINGCAPS
{
    public uint dwSize;
    public uint dwCaps;
    public uint dwLightingModel;
    public uint dwNumLights;
}

[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 D3DDEVICEDESC
{
    public uint dwSize;
    public uint dwFlags;
    public uint dcmColorModel;
    public uint dwDevCaps;
    public D3DTRANSFORMCAPS dtcTransformCaps;
    [MarshalAs(UnmanagedType.Bool)] public bool bClipping;
    public D3DLIGHTINGCAPS dlcLightingCaps;
    public D3DPRIMCAPS dpcLineCaps;
    public D3DPRIMCAPS dpcTriCaps;
    public uint dwDeviceRenderBitDepth;
    public uint dwDeviceZBufferBitDepth;
    public uint dwMaxBufferSize;
    public uint dwMaxVertexCount;
    public uint dwMinTextureWidth;
    public uint dwMinTextureHeight;
    public uint dwMaxTextureWidth;
    public uint dwMaxTextureHeight;
    public uint dwMinStippleWidth;
    public uint dwMaxStippleWidth;
    public uint dwMinStippleHeight;
    public uint dwMaxStippleHeight;
    public uint dwMaxTextureRepeat;
    public uint dwMaxTextureAspectRatio;
    public uint dwMaxAnisotropy;
    public float dvGuardBandLeft;
    public float dvGuardBandTop;
    public float dvGuardBandRight;
    public float dvGuardBandBottom;
    public float dvExtentsAdjust;
    public uint dwStencilCaps;
    public uint dwFVFCaps;
    public uint dwTextureOpCaps;
    public ushort wMaxTextureBlendStages;
    public ushort wMaxSimultaneousTextures;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DFINDDEVICERESULT
{
    public uint dwSize;
    public Guid guid;
    public D3DDEVICEDESC ddHwDesc;
    public D3DDEVICEDESC ddSwDesc;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DTRANSFORMCAPS
    Public dwSize As UInteger
    Public dwCaps As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DLIGHTINGCAPS
    Public dwSize As UInteger
    Public dwCaps As UInteger
    Public dwLightingModel As UInteger
    Public dwNumLights As UInteger
End Structure

<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 D3DDEVICEDESC
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public dcmColorModel As UInteger
    Public dwDevCaps As UInteger
    Public dtcTransformCaps As D3DTRANSFORMCAPS
    <MarshalAs(UnmanagedType.Bool)> Public bClipping As Boolean
    Public dlcLightingCaps As D3DLIGHTINGCAPS
    Public dpcLineCaps As D3DPRIMCAPS
    Public dpcTriCaps As D3DPRIMCAPS
    Public dwDeviceRenderBitDepth As UInteger
    Public dwDeviceZBufferBitDepth As UInteger
    Public dwMaxBufferSize As UInteger
    Public dwMaxVertexCount As UInteger
    Public dwMinTextureWidth As UInteger
    Public dwMinTextureHeight As UInteger
    Public dwMaxTextureWidth As UInteger
    Public dwMaxTextureHeight As UInteger
    Public dwMinStippleWidth As UInteger
    Public dwMaxStippleWidth As UInteger
    Public dwMinStippleHeight As UInteger
    Public dwMaxStippleHeight As UInteger
    Public dwMaxTextureRepeat As UInteger
    Public dwMaxTextureAspectRatio As UInteger
    Public dwMaxAnisotropy As UInteger
    Public dvGuardBandLeft As Single
    Public dvGuardBandTop As Single
    Public dvGuardBandRight As Single
    Public dvGuardBandBottom As Single
    Public dvExtentsAdjust As Single
    Public dwStencilCaps As UInteger
    Public dwFVFCaps As UInteger
    Public dwTextureOpCaps As UInteger
    Public wMaxTextureBlendStages As UShort
    Public wMaxSimultaneousTextures As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DFINDDEVICERESULT
    Public dwSize As UInteger
    Public guid As Guid
    Public ddHwDesc As D3DDEVICEDESC
    Public ddSwDesc As D3DDEVICEDESC
End Structure
import ctypes
from ctypes import wintypes

class D3DTRANSFORMCAPS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwCaps", wintypes.DWORD),
    ]

class D3DLIGHTINGCAPS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwCaps", wintypes.DWORD),
        ("dwLightingModel", wintypes.DWORD),
        ("dwNumLights", wintypes.DWORD),
    ]

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 D3DDEVICEDESC(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dcmColorModel", wintypes.DWORD),
        ("dwDevCaps", wintypes.DWORD),
        ("dtcTransformCaps", D3DTRANSFORMCAPS),
        ("bClipping", wintypes.BOOL),
        ("dlcLightingCaps", D3DLIGHTINGCAPS),
        ("dpcLineCaps", D3DPRIMCAPS),
        ("dpcTriCaps", D3DPRIMCAPS),
        ("dwDeviceRenderBitDepth", wintypes.DWORD),
        ("dwDeviceZBufferBitDepth", wintypes.DWORD),
        ("dwMaxBufferSize", wintypes.DWORD),
        ("dwMaxVertexCount", wintypes.DWORD),
        ("dwMinTextureWidth", wintypes.DWORD),
        ("dwMinTextureHeight", wintypes.DWORD),
        ("dwMaxTextureWidth", wintypes.DWORD),
        ("dwMaxTextureHeight", wintypes.DWORD),
        ("dwMinStippleWidth", wintypes.DWORD),
        ("dwMaxStippleWidth", wintypes.DWORD),
        ("dwMinStippleHeight", wintypes.DWORD),
        ("dwMaxStippleHeight", wintypes.DWORD),
        ("dwMaxTextureRepeat", wintypes.DWORD),
        ("dwMaxTextureAspectRatio", wintypes.DWORD),
        ("dwMaxAnisotropy", wintypes.DWORD),
        ("dvGuardBandLeft", ctypes.c_float),
        ("dvGuardBandTop", ctypes.c_float),
        ("dvGuardBandRight", ctypes.c_float),
        ("dvGuardBandBottom", ctypes.c_float),
        ("dvExtentsAdjust", ctypes.c_float),
        ("dwStencilCaps", wintypes.DWORD),
        ("dwFVFCaps", wintypes.DWORD),
        ("dwTextureOpCaps", wintypes.DWORD),
        ("wMaxTextureBlendStages", ctypes.c_ushort),
        ("wMaxSimultaneousTextures", ctypes.c_ushort),
    ]

class D3DFINDDEVICERESULT(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("guid", GUID),
        ("ddHwDesc", D3DDEVICEDESC),
        ("ddSwDesc", D3DDEVICEDESC),
    ]
#[repr(C)]
pub struct D3DTRANSFORMCAPS {
    pub dwSize: u32,
    pub dwCaps: u32,
}

#[repr(C)]
pub struct D3DLIGHTINGCAPS {
    pub dwSize: u32,
    pub dwCaps: u32,
    pub dwLightingModel: u32,
    pub dwNumLights: u32,
}

#[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 D3DDEVICEDESC {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub dcmColorModel: u32,
    pub dwDevCaps: u32,
    pub dtcTransformCaps: D3DTRANSFORMCAPS,
    pub bClipping: i32,
    pub dlcLightingCaps: D3DLIGHTINGCAPS,
    pub dpcLineCaps: D3DPRIMCAPS,
    pub dpcTriCaps: D3DPRIMCAPS,
    pub dwDeviceRenderBitDepth: u32,
    pub dwDeviceZBufferBitDepth: u32,
    pub dwMaxBufferSize: u32,
    pub dwMaxVertexCount: u32,
    pub dwMinTextureWidth: u32,
    pub dwMinTextureHeight: u32,
    pub dwMaxTextureWidth: u32,
    pub dwMaxTextureHeight: u32,
    pub dwMinStippleWidth: u32,
    pub dwMaxStippleWidth: u32,
    pub dwMinStippleHeight: u32,
    pub dwMaxStippleHeight: u32,
    pub dwMaxTextureRepeat: u32,
    pub dwMaxTextureAspectRatio: u32,
    pub dwMaxAnisotropy: u32,
    pub dvGuardBandLeft: f32,
    pub dvGuardBandTop: f32,
    pub dvGuardBandRight: f32,
    pub dvGuardBandBottom: f32,
    pub dvExtentsAdjust: f32,
    pub dwStencilCaps: u32,
    pub dwFVFCaps: u32,
    pub dwTextureOpCaps: u32,
    pub wMaxTextureBlendStages: u16,
    pub wMaxSimultaneousTextures: u16,
}

#[repr(C)]
pub struct D3DFINDDEVICERESULT {
    pub dwSize: u32,
    pub guid: GUID,
    pub ddHwDesc: D3DDEVICEDESC,
    pub ddSwDesc: D3DDEVICEDESC,
}
import "golang.org/x/sys/windows"

type D3DTRANSFORMCAPS struct {
	dwSize uint32
	dwCaps uint32
}

type D3DLIGHTINGCAPS struct {
	dwSize uint32
	dwCaps uint32
	dwLightingModel uint32
	dwNumLights uint32
}

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 D3DDEVICEDESC struct {
	dwSize uint32
	dwFlags uint32
	dcmColorModel uint32
	dwDevCaps uint32
	dtcTransformCaps D3DTRANSFORMCAPS
	bClipping int32
	dlcLightingCaps D3DLIGHTINGCAPS
	dpcLineCaps D3DPRIMCAPS
	dpcTriCaps D3DPRIMCAPS
	dwDeviceRenderBitDepth uint32
	dwDeviceZBufferBitDepth uint32
	dwMaxBufferSize uint32
	dwMaxVertexCount uint32
	dwMinTextureWidth uint32
	dwMinTextureHeight uint32
	dwMaxTextureWidth uint32
	dwMaxTextureHeight uint32
	dwMinStippleWidth uint32
	dwMaxStippleWidth uint32
	dwMinStippleHeight uint32
	dwMaxStippleHeight uint32
	dwMaxTextureRepeat uint32
	dwMaxTextureAspectRatio uint32
	dwMaxAnisotropy uint32
	dvGuardBandLeft float32
	dvGuardBandTop float32
	dvGuardBandRight float32
	dvGuardBandBottom float32
	dvExtentsAdjust float32
	dwStencilCaps uint32
	dwFVFCaps uint32
	dwTextureOpCaps uint32
	wMaxTextureBlendStages uint16
	wMaxSimultaneousTextures uint16
}

type D3DFINDDEVICERESULT struct {
	dwSize uint32
	guid windows.GUID
	ddHwDesc D3DDEVICEDESC
	ddSwDesc D3DDEVICEDESC
}
type
  D3DTRANSFORMCAPS = record
    dwSize: DWORD;
    dwCaps: DWORD;
  end;

  D3DLIGHTINGCAPS = record
    dwSize: DWORD;
    dwCaps: DWORD;
    dwLightingModel: DWORD;
    dwNumLights: DWORD;
  end;

  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;

  D3DDEVICEDESC = record
    dwSize: DWORD;
    dwFlags: DWORD;
    dcmColorModel: DWORD;
    dwDevCaps: DWORD;
    dtcTransformCaps: D3DTRANSFORMCAPS;
    bClipping: BOOL;
    dlcLightingCaps: D3DLIGHTINGCAPS;
    dpcLineCaps: D3DPRIMCAPS;
    dpcTriCaps: D3DPRIMCAPS;
    dwDeviceRenderBitDepth: DWORD;
    dwDeviceZBufferBitDepth: DWORD;
    dwMaxBufferSize: DWORD;
    dwMaxVertexCount: DWORD;
    dwMinTextureWidth: DWORD;
    dwMinTextureHeight: DWORD;
    dwMaxTextureWidth: DWORD;
    dwMaxTextureHeight: DWORD;
    dwMinStippleWidth: DWORD;
    dwMaxStippleWidth: DWORD;
    dwMinStippleHeight: DWORD;
    dwMaxStippleHeight: DWORD;
    dwMaxTextureRepeat: DWORD;
    dwMaxTextureAspectRatio: DWORD;
    dwMaxAnisotropy: DWORD;
    dvGuardBandLeft: Single;
    dvGuardBandTop: Single;
    dvGuardBandRight: Single;
    dvGuardBandBottom: Single;
    dvExtentsAdjust: Single;
    dwStencilCaps: DWORD;
    dwFVFCaps: DWORD;
    dwTextureOpCaps: DWORD;
    wMaxTextureBlendStages: Word;
    wMaxSimultaneousTextures: Word;
  end;

  D3DFINDDEVICERESULT = record
    dwSize: DWORD;
    guid: TGUID;
    ddHwDesc: D3DDEVICEDESC;
    ddSwDesc: D3DDEVICEDESC;
  end;
const D3DTRANSFORMCAPS = extern struct {
    dwSize: u32,
    dwCaps: u32,
};

const D3DLIGHTINGCAPS = extern struct {
    dwSize: u32,
    dwCaps: u32,
    dwLightingModel: u32,
    dwNumLights: u32,
};

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 D3DDEVICEDESC = extern struct {
    dwSize: u32,
    dwFlags: u32,
    dcmColorModel: u32,
    dwDevCaps: u32,
    dtcTransformCaps: D3DTRANSFORMCAPS,
    bClipping: i32,
    dlcLightingCaps: D3DLIGHTINGCAPS,
    dpcLineCaps: D3DPRIMCAPS,
    dpcTriCaps: D3DPRIMCAPS,
    dwDeviceRenderBitDepth: u32,
    dwDeviceZBufferBitDepth: u32,
    dwMaxBufferSize: u32,
    dwMaxVertexCount: u32,
    dwMinTextureWidth: u32,
    dwMinTextureHeight: u32,
    dwMaxTextureWidth: u32,
    dwMaxTextureHeight: u32,
    dwMinStippleWidth: u32,
    dwMaxStippleWidth: u32,
    dwMinStippleHeight: u32,
    dwMaxStippleHeight: u32,
    dwMaxTextureRepeat: u32,
    dwMaxTextureAspectRatio: u32,
    dwMaxAnisotropy: u32,
    dvGuardBandLeft: f32,
    dvGuardBandTop: f32,
    dvGuardBandRight: f32,
    dvGuardBandBottom: f32,
    dvExtentsAdjust: f32,
    dwStencilCaps: u32,
    dwFVFCaps: u32,
    dwTextureOpCaps: u32,
    wMaxTextureBlendStages: u16,
    wMaxSimultaneousTextures: u16,
};

const D3DFINDDEVICERESULT = extern struct {
    dwSize: u32,
    guid: GUID,
    ddHwDesc: D3DDEVICEDESC,
    ddSwDesc: D3DDEVICEDESC,
};
type
  D3DTRANSFORMCAPS {.bycopy.} = object
    dwSize: uint32
    dwCaps: uint32

  D3DLIGHTINGCAPS {.bycopy.} = object
    dwSize: uint32
    dwCaps: uint32
    dwLightingModel: uint32
    dwNumLights: uint32

  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

  D3DDEVICEDESC {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    dcmColorModel: uint32
    dwDevCaps: uint32
    dtcTransformCaps: D3DTRANSFORMCAPS
    bClipping: int32
    dlcLightingCaps: D3DLIGHTINGCAPS
    dpcLineCaps: D3DPRIMCAPS
    dpcTriCaps: D3DPRIMCAPS
    dwDeviceRenderBitDepth: uint32
    dwDeviceZBufferBitDepth: uint32
    dwMaxBufferSize: uint32
    dwMaxVertexCount: uint32
    dwMinTextureWidth: uint32
    dwMinTextureHeight: uint32
    dwMaxTextureWidth: uint32
    dwMaxTextureHeight: uint32
    dwMinStippleWidth: uint32
    dwMaxStippleWidth: uint32
    dwMinStippleHeight: uint32
    dwMaxStippleHeight: uint32
    dwMaxTextureRepeat: uint32
    dwMaxTextureAspectRatio: uint32
    dwMaxAnisotropy: uint32
    dvGuardBandLeft: float32
    dvGuardBandTop: float32
    dvGuardBandRight: float32
    dvGuardBandBottom: float32
    dvExtentsAdjust: float32
    dwStencilCaps: uint32
    dwFVFCaps: uint32
    dwTextureOpCaps: uint32
    wMaxTextureBlendStages: uint16
    wMaxSimultaneousTextures: uint16

  D3DFINDDEVICERESULT {.bycopy.} = object
    dwSize: uint32
    guid: GUID
    ddHwDesc: D3DDEVICEDESC
    ddSwDesc: D3DDEVICEDESC
struct D3DTRANSFORMCAPS
{
    uint dwSize;
    uint dwCaps;
}

struct D3DLIGHTINGCAPS
{
    uint dwSize;
    uint dwCaps;
    uint dwLightingModel;
    uint dwNumLights;
}

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 D3DDEVICEDESC
{
    uint dwSize;
    uint dwFlags;
    uint dcmColorModel;
    uint dwDevCaps;
    D3DTRANSFORMCAPS dtcTransformCaps;
    int bClipping;
    D3DLIGHTINGCAPS dlcLightingCaps;
    D3DPRIMCAPS dpcLineCaps;
    D3DPRIMCAPS dpcTriCaps;
    uint dwDeviceRenderBitDepth;
    uint dwDeviceZBufferBitDepth;
    uint dwMaxBufferSize;
    uint dwMaxVertexCount;
    uint dwMinTextureWidth;
    uint dwMinTextureHeight;
    uint dwMaxTextureWidth;
    uint dwMaxTextureHeight;
    uint dwMinStippleWidth;
    uint dwMaxStippleWidth;
    uint dwMinStippleHeight;
    uint dwMaxStippleHeight;
    uint dwMaxTextureRepeat;
    uint dwMaxTextureAspectRatio;
    uint dwMaxAnisotropy;
    float dvGuardBandLeft;
    float dvGuardBandTop;
    float dvGuardBandRight;
    float dvGuardBandBottom;
    float dvExtentsAdjust;
    uint dwStencilCaps;
    uint dwFVFCaps;
    uint dwTextureOpCaps;
    ushort wMaxTextureBlendStages;
    ushort wMaxSimultaneousTextures;
}

struct D3DFINDDEVICERESULT
{
    uint dwSize;
    GUID guid;
    D3DDEVICEDESC ddHwDesc;
    D3DDEVICEDESC ddSwDesc;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DFINDDEVICERESULT サイズ: 524 バイト(x64)
dim st, 131    ; 4byte整数×131(構造体サイズ 524 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; guid : GUID (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; ddHwDesc : D3DDEVICEDESC (+20, 252byte)  varptr(st)+20 を基点に操作(252byte:入れ子/配列)
; ddSwDesc : D3DDEVICEDESC (+272, 252byte)  varptr(st)+272 を基点に操作(252byte:入れ子/配列)
; ※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 D3DTRANSFORMCAPS
    #field int dwSize
    #field int dwCaps
#endstruct

#defstruct global D3DLIGHTINGCAPS
    #field int dwSize
    #field int dwCaps
    #field int dwLightingModel
    #field int dwNumLights
#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 D3DDEVICEDESC
    #field int dwSize
    #field int dwFlags
    #field int dcmColorModel
    #field int dwDevCaps
    #field D3DTRANSFORMCAPS dtcTransformCaps
    #field bool bClipping
    #field D3DLIGHTINGCAPS dlcLightingCaps
    #field D3DPRIMCAPS dpcLineCaps
    #field D3DPRIMCAPS dpcTriCaps
    #field int dwDeviceRenderBitDepth
    #field int dwDeviceZBufferBitDepth
    #field int dwMaxBufferSize
    #field int dwMaxVertexCount
    #field int dwMinTextureWidth
    #field int dwMinTextureHeight
    #field int dwMaxTextureWidth
    #field int dwMaxTextureHeight
    #field int dwMinStippleWidth
    #field int dwMaxStippleWidth
    #field int dwMinStippleHeight
    #field int dwMaxStippleHeight
    #field int dwMaxTextureRepeat
    #field int dwMaxTextureAspectRatio
    #field int dwMaxAnisotropy
    #field float dvGuardBandLeft
    #field float dvGuardBandTop
    #field float dvGuardBandRight
    #field float dvGuardBandBottom
    #field float dvExtentsAdjust
    #field int dwStencilCaps
    #field int dwFVFCaps
    #field int dwTextureOpCaps
    #field short wMaxTextureBlendStages
    #field short wMaxSimultaneousTextures
#endstruct

#defstruct global D3DFINDDEVICERESULT
    #field int dwSize
    #field GUID guid
    #field D3DDEVICEDESC ddHwDesc
    #field D3DDEVICEDESC ddSwDesc
#endstruct

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