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

D3D12_PLACED_SUBRESOURCE_FOOTPRINT

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

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

フィールド

フィールドサイズx64x86説明
OffsetULONGLONG8+0+0親リソース内での配置オフセット(バイト)。512バイト境界にアラインされる。
FootprintD3D12_SUBRESOURCE_FOOTPRINT20+8+8サブリソースのフットプリント(フォーマットや寸法)。

各言語での定義

#include <windows.h>

// D3D12_SUBRESOURCE_FOOTPRINT  (x64 20 / x86 20 バイト)
typedef struct D3D12_SUBRESOURCE_FOOTPRINT {
    DXGI_FORMAT Format;
    DWORD Width;
    DWORD Height;
    DWORD Depth;
    DWORD RowPitch;
} D3D12_SUBRESOURCE_FOOTPRINT;

// D3D12_PLACED_SUBRESOURCE_FOOTPRINT  (x64 32 / x86 32 バイト)
typedef struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT {
    ULONGLONG Offset;
    D3D12_SUBRESOURCE_FOOTPRINT Footprint;
} D3D12_PLACED_SUBRESOURCE_FOOTPRINT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_SUBRESOURCE_FOOTPRINT
{
    public int Format;
    public uint Width;
    public uint Height;
    public uint Depth;
    public uint RowPitch;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT
{
    public ulong Offset;
    public D3D12_SUBRESOURCE_FOOTPRINT Footprint;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_SUBRESOURCE_FOOTPRINT
    Public Format As Integer
    Public Width As UInteger
    Public Height As UInteger
    Public Depth As UInteger
    Public RowPitch As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_PLACED_SUBRESOURCE_FOOTPRINT
    Public Offset As ULong
    Public Footprint As D3D12_SUBRESOURCE_FOOTPRINT
End Structure
import ctypes
from ctypes import wintypes

class D3D12_SUBRESOURCE_FOOTPRINT(ctypes.Structure):
    _fields_ = [
        ("Format", ctypes.c_int),
        ("Width", wintypes.DWORD),
        ("Height", wintypes.DWORD),
        ("Depth", wintypes.DWORD),
        ("RowPitch", wintypes.DWORD),
    ]

class D3D12_PLACED_SUBRESOURCE_FOOTPRINT(ctypes.Structure):
    _fields_ = [
        ("Offset", ctypes.c_ulonglong),
        ("Footprint", D3D12_SUBRESOURCE_FOOTPRINT),
    ]
#[repr(C)]
pub struct D3D12_SUBRESOURCE_FOOTPRINT {
    pub Format: i32,
    pub Width: u32,
    pub Height: u32,
    pub Depth: u32,
    pub RowPitch: u32,
}

#[repr(C)]
pub struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT {
    pub Offset: u64,
    pub Footprint: D3D12_SUBRESOURCE_FOOTPRINT,
}
import "golang.org/x/sys/windows"

type D3D12_SUBRESOURCE_FOOTPRINT struct {
	Format int32
	Width uint32
	Height uint32
	Depth uint32
	RowPitch uint32
}

type D3D12_PLACED_SUBRESOURCE_FOOTPRINT struct {
	Offset uint64
	Footprint D3D12_SUBRESOURCE_FOOTPRINT
}
type
  D3D12_SUBRESOURCE_FOOTPRINT = record
    Format: Integer;
    Width: DWORD;
    Height: DWORD;
    Depth: DWORD;
    RowPitch: DWORD;
  end;

  D3D12_PLACED_SUBRESOURCE_FOOTPRINT = record
    Offset: UInt64;
    Footprint: D3D12_SUBRESOURCE_FOOTPRINT;
  end;
const D3D12_SUBRESOURCE_FOOTPRINT = extern struct {
    Format: i32,
    Width: u32,
    Height: u32,
    Depth: u32,
    RowPitch: u32,
};

const D3D12_PLACED_SUBRESOURCE_FOOTPRINT = extern struct {
    Offset: u64,
    Footprint: D3D12_SUBRESOURCE_FOOTPRINT,
};
type
  D3D12_SUBRESOURCE_FOOTPRINT {.bycopy.} = object
    Format: int32
    Width: uint32
    Height: uint32
    Depth: uint32
    RowPitch: uint32

  D3D12_PLACED_SUBRESOURCE_FOOTPRINT {.bycopy.} = object
    Offset: uint64
    Footprint: D3D12_SUBRESOURCE_FOOTPRINT
struct D3D12_SUBRESOURCE_FOOTPRINT
{
    int Format;
    uint Width;
    uint Height;
    uint Depth;
    uint RowPitch;
}

struct D3D12_PLACED_SUBRESOURCE_FOOTPRINT
{
    ulong Offset;
    D3D12_SUBRESOURCE_FOOTPRINT Footprint;
}

HSP用 定義

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

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

#defstruct global D3D12_PLACED_SUBRESOURCE_FOOTPRINT
    #field int64 Offset
    #field D3D12_SUBRESOURCE_FOOTPRINT Footprint
#endstruct

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