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

D3D12_HEAP_DESC

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

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

フィールド

フィールドサイズx64x86説明
SizeInBytesULONGLONG8+0+0ヒープのバイトサイズ。
PropertiesD3D12_HEAP_PROPERTIES20+8+8ヒープのプロパティ(種別やメモリ特性)。
AlignmentULONGLONG8+32+32ヒープのアライメント(バイト)。0で既定値となる。
FlagsD3D12_HEAP_FLAGS4+40+40ヒープ生成オプションフラグ。共有可否や許可リソース種別など。

各言語での定義

#include <windows.h>

// D3D12_HEAP_PROPERTIES  (x64 20 / x86 20 バイト)
typedef struct D3D12_HEAP_PROPERTIES {
    D3D12_HEAP_TYPE Type;
    D3D12_CPU_PAGE_PROPERTY CPUPageProperty;
    D3D12_MEMORY_POOL MemoryPoolPreference;
    DWORD CreationNodeMask;
    DWORD VisibleNodeMask;
} D3D12_HEAP_PROPERTIES;

// D3D12_HEAP_DESC  (x64 48 / x86 48 バイト)
typedef struct D3D12_HEAP_DESC {
    ULONGLONG SizeInBytes;
    D3D12_HEAP_PROPERTIES Properties;
    ULONGLONG Alignment;
    D3D12_HEAP_FLAGS Flags;
} D3D12_HEAP_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_HEAP_PROPERTIES
{
    public int Type;
    public int CPUPageProperty;
    public int MemoryPoolPreference;
    public uint CreationNodeMask;
    public uint VisibleNodeMask;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_HEAP_DESC
{
    public ulong SizeInBytes;
    public D3D12_HEAP_PROPERTIES Properties;
    public ulong Alignment;
    public int Flags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_HEAP_PROPERTIES
    Public Type As Integer
    Public CPUPageProperty As Integer
    Public MemoryPoolPreference As Integer
    Public CreationNodeMask As UInteger
    Public VisibleNodeMask As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_HEAP_DESC
    Public SizeInBytes As ULong
    Public Properties As D3D12_HEAP_PROPERTIES
    Public Alignment As ULong
    Public Flags As Integer
End Structure
import ctypes
from ctypes import wintypes

class D3D12_HEAP_PROPERTIES(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_int),
        ("CPUPageProperty", ctypes.c_int),
        ("MemoryPoolPreference", ctypes.c_int),
        ("CreationNodeMask", wintypes.DWORD),
        ("VisibleNodeMask", wintypes.DWORD),
    ]

class D3D12_HEAP_DESC(ctypes.Structure):
    _fields_ = [
        ("SizeInBytes", ctypes.c_ulonglong),
        ("Properties", D3D12_HEAP_PROPERTIES),
        ("Alignment", ctypes.c_ulonglong),
        ("Flags", ctypes.c_int),
    ]
#[repr(C)]
pub struct D3D12_HEAP_PROPERTIES {
    pub Type: i32,
    pub CPUPageProperty: i32,
    pub MemoryPoolPreference: i32,
    pub CreationNodeMask: u32,
    pub VisibleNodeMask: u32,
}

#[repr(C)]
pub struct D3D12_HEAP_DESC {
    pub SizeInBytes: u64,
    pub Properties: D3D12_HEAP_PROPERTIES,
    pub Alignment: u64,
    pub Flags: i32,
}
import "golang.org/x/sys/windows"

type D3D12_HEAP_PROPERTIES struct {
	Type int32
	CPUPageProperty int32
	MemoryPoolPreference int32
	CreationNodeMask uint32
	VisibleNodeMask uint32
}

type D3D12_HEAP_DESC struct {
	SizeInBytes uint64
	Properties D3D12_HEAP_PROPERTIES
	Alignment uint64
	Flags int32
}
type
  D3D12_HEAP_PROPERTIES = record
    Type: Integer;
    CPUPageProperty: Integer;
    MemoryPoolPreference: Integer;
    CreationNodeMask: DWORD;
    VisibleNodeMask: DWORD;
  end;

  D3D12_HEAP_DESC = record
    SizeInBytes: UInt64;
    Properties: D3D12_HEAP_PROPERTIES;
    Alignment: UInt64;
    Flags: Integer;
  end;
const D3D12_HEAP_PROPERTIES = extern struct {
    Type: i32,
    CPUPageProperty: i32,
    MemoryPoolPreference: i32,
    CreationNodeMask: u32,
    VisibleNodeMask: u32,
};

const D3D12_HEAP_DESC = extern struct {
    SizeInBytes: u64,
    Properties: D3D12_HEAP_PROPERTIES,
    Alignment: u64,
    Flags: i32,
};
type
  D3D12_HEAP_PROPERTIES {.bycopy.} = object
    Type: int32
    CPUPageProperty: int32
    MemoryPoolPreference: int32
    CreationNodeMask: uint32
    VisibleNodeMask: uint32

  D3D12_HEAP_DESC {.bycopy.} = object
    SizeInBytes: uint64
    Properties: D3D12_HEAP_PROPERTIES
    Alignment: uint64
    Flags: int32
struct D3D12_HEAP_PROPERTIES
{
    int Type;
    int CPUPageProperty;
    int MemoryPoolPreference;
    uint CreationNodeMask;
    uint VisibleNodeMask;
}

struct D3D12_HEAP_DESC
{
    ulong SizeInBytes;
    D3D12_HEAP_PROPERTIES Properties;
    ulong Alignment;
    int Flags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_HEAP_DESC サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; SizeInBytes : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Properties : D3D12_HEAP_PROPERTIES (+8, 20byte)  varptr(st)+8 を基点に操作(20byte:入れ子/配列)
; Alignment : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Flags : D3D12_HEAP_FLAGS (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_HEAP_PROPERTIES
    #field int Type
    #field int CPUPageProperty
    #field int MemoryPoolPreference
    #field int CreationNodeMask
    #field int VisibleNodeMask
#endstruct

#defstruct global D3D12_HEAP_DESC
    #field int64 SizeInBytes
    #field D3D12_HEAP_PROPERTIES Properties
    #field int64 Alignment
    #field int Flags
#endstruct

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