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

D3D12_RT_FORMAT_ARRAY

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

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

フィールド

フィールドサイズx64x86説明
RTFormatsDXGI_FORMAT32+0+0レンダーターゲットフォーマットの配列。8要素のDXGI_FORMAT。
NumRenderTargetsDWORD4+32+32有効なレンダーターゲットフォーマット数。最大8。

各言語での定義

#include <windows.h>

// D3D12_RT_FORMAT_ARRAY  (x64 36 / x86 36 バイト)
typedef struct D3D12_RT_FORMAT_ARRAY {
    DXGI_FORMAT RTFormats[8];
    DWORD NumRenderTargets;
} D3D12_RT_FORMAT_ARRAY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_RT_FORMAT_ARRAY
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public int[] RTFormats;
    public uint NumRenderTargets;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_RT_FORMAT_ARRAY
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public RTFormats() As Integer
    Public NumRenderTargets As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3D12_RT_FORMAT_ARRAY(ctypes.Structure):
    _fields_ = [
        ("RTFormats", ctypes.c_int * 8),
        ("NumRenderTargets", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3D12_RT_FORMAT_ARRAY {
    pub RTFormats: [i32; 8],
    pub NumRenderTargets: u32,
}
import "golang.org/x/sys/windows"

type D3D12_RT_FORMAT_ARRAY struct {
	RTFormats [8]int32
	NumRenderTargets uint32
}
type
  D3D12_RT_FORMAT_ARRAY = record
    RTFormats: array[0..7] of Integer;
    NumRenderTargets: DWORD;
  end;
const D3D12_RT_FORMAT_ARRAY = extern struct {
    RTFormats: [8]i32,
    NumRenderTargets: u32,
};
type
  D3D12_RT_FORMAT_ARRAY {.bycopy.} = object
    RTFormats: array[8, int32]
    NumRenderTargets: uint32
struct D3D12_RT_FORMAT_ARRAY
{
    int[8] RTFormats;
    uint NumRenderTargets;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_RT_FORMAT_ARRAY サイズ: 36 バイト(x64)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; RTFormats : DXGI_FORMAT (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; NumRenderTargets : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_RT_FORMAT_ARRAY
    #field int RTFormats 8
    #field int NumRenderTargets
#endstruct

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