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

D3D12_RAYTRACING_GEOMETRY_DESC

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

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

フィールド

フィールドサイズx64x86説明
TypeD3D12_RAYTRACING_GEOMETRY_TYPE4+0+0ジオメトリの種類です。
FlagsD3D12_RAYTRACING_GEOMETRY_FLAGS4+4+4ジオメトリのフラグです。
Anonymous_Anonymous_e__Union48+8+8Typeに応じて三角形またはAABB記述を保持する無名共用体。

共用体: _Anonymous_e__Union x64 48B / x86 48B

フィールドサイズx64x86説明
TrianglesD3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC48+0+0TypeD3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES の場合に、三角形ジオメトリを記述する D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC です。それ以外の場合、このパラメーターは使用されません。
AABBsD3D12_RAYTRACING_GEOMETRY_AABBS_DESC24+0+0TypeD3D12_RAYTRACING_GEOMETRY_TYPE_PROCEDURAL_PRIMITIVE_AABBS の場合に、三角形ジオメトリを記述する D3D12_RAYTRACING_GEOMETRY_AABBS_DESC です。それ以外の場合、このパラメーターは使用されません。
OmmTrianglesD3D12_RAYTRACING_GEOMETRY_OMM_TRIANGLES_DESC16/8+0+0

公式ドキュメント

レイトレーシング高速化構造体のビルド操作に入力データを提供するため、D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS 構造体で使用されるジオメトリのセットを記述します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// D3D12_RAYTRACING_GEOMETRY_DESC  (x64 56 / x86 56 バイト)
typedef struct D3D12_RAYTRACING_GEOMETRY_DESC {
    D3D12_RAYTRACING_GEOMETRY_TYPE Type;
    D3D12_RAYTRACING_GEOMETRY_FLAGS Flags;
    _Anonymous_e__Union Anonymous;
} D3D12_RAYTRACING_GEOMETRY_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_RAYTRACING_GEOMETRY_DESC
{
    public int Type;
    public int Flags;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_RAYTRACING_GEOMETRY_DESC
    Public Type As Integer
    Public Flags As Integer
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class D3D12_RAYTRACING_GEOMETRY_DESC(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_int),
        ("Flags", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct D3D12_RAYTRACING_GEOMETRY_DESC {
    pub Type: i32,
    pub Flags: i32,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type D3D12_RAYTRACING_GEOMETRY_DESC struct {
	Type int32
	Flags int32
	Anonymous _Anonymous_e__Union
}
type
  D3D12_RAYTRACING_GEOMETRY_DESC = record
    Type: Integer;
    Flags: Integer;
    Anonymous: _Anonymous_e__Union;
  end;
const D3D12_RAYTRACING_GEOMETRY_DESC = extern struct {
    Type: i32,
    Flags: i32,
    Anonymous: _Anonymous_e__Union,
};
type
  D3D12_RAYTRACING_GEOMETRY_DESC {.bycopy.} = object
    Type: int32
    Flags: int32
    Anonymous: _Anonymous_e__Union
struct D3D12_RAYTRACING_GEOMETRY_DESC
{
    int Type;
    int Flags;
    _Anonymous_e__Union Anonymous;
}

HSP用 定義

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

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

stdim st, D3D12_RAYTRACING_GEOMETRY_DESC        ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。