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

D3D12_RESOURCE_DESC1

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

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

フィールド

フィールドサイズx64x86説明
DimensionD3D12_RESOURCE_DIMENSION4+0+0D3D12_RESOURCE_DIMENSION のメンバーの 1 つで、リソースの次元 (たとえば D3D12_RESOURCE_DIMENSION_TEXTURE1D)、またはバッファーであるかどうか ((D3D12_RESOURCE_DIMENSION_BUFFER) を指定します。
AlignmentULONGLONG8+8+8アラインメントを指定します。
WidthULONGLONG8+16+16リソースの幅を指定します。
HeightDWORD4+24+24リソースの高さを指定します。
DepthOrArraySizeWORD2+28+28リソースが 3D の場合はその深度を、1D または 2D リソースの配列の場合は配列サイズを指定します。
MipLevelsWORD2+30+30MIP レベルの数を指定します。
FormatDXGI_FORMAT4+32+32DXGI_FORMAT のメンバーを 1 つ指定します。
SampleDescDXGI_SAMPLE_DESC8+36+36DXGI_SAMPLE_DESC 構造体を指定します。
LayoutD3D12_TEXTURE_LAYOUT4+44+44D3D12_TEXTURE_LAYOUT のメンバーを 1 つ指定します。
FlagsD3D12_RESOURCE_FLAGS4+48+48D3D12_RESOURCE_FLAGS 列挙型の定数をビット単位の OR で組み合わせたフラグです。
SamplerFeedbackMipRegionD3D12_MIP_REGION12+52+52D3D12_MIP_REGION 構造体です。

公式ドキュメント

テクスチャなどのリソースを、mip 領域も含めて記述します。この構造体はいくつかのメソッドで使用されます。

解説(Remarks)

解説については、D3D12_RESOURCE_DESC を参照してください。

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

各言語での定義

#include <windows.h>

// DXGI_SAMPLE_DESC  (x64 8 / x86 8 バイト)
typedef struct DXGI_SAMPLE_DESC {
    DWORD Count;
    DWORD Quality;
} DXGI_SAMPLE_DESC;

// D3D12_MIP_REGION  (x64 12 / x86 12 バイト)
typedef struct D3D12_MIP_REGION {
    DWORD Width;
    DWORD Height;
    DWORD Depth;
} D3D12_MIP_REGION;

// D3D12_RESOURCE_DESC1  (x64 64 / x86 64 バイト)
typedef struct D3D12_RESOURCE_DESC1 {
    D3D12_RESOURCE_DIMENSION Dimension;
    ULONGLONG Alignment;
    ULONGLONG Width;
    DWORD Height;
    WORD DepthOrArraySize;
    WORD MipLevels;
    DXGI_FORMAT Format;
    DXGI_SAMPLE_DESC SampleDesc;
    D3D12_TEXTURE_LAYOUT Layout;
    D3D12_RESOURCE_FLAGS Flags;
    D3D12_MIP_REGION SamplerFeedbackMipRegion;
} D3D12_RESOURCE_DESC1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_SAMPLE_DESC
{
    public uint Count;
    public uint Quality;
}

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_RESOURCE_DESC1
{
    public int Dimension;
    public ulong Alignment;
    public ulong Width;
    public uint Height;
    public ushort DepthOrArraySize;
    public ushort MipLevels;
    public int Format;
    public DXGI_SAMPLE_DESC SampleDesc;
    public int Layout;
    public int Flags;
    public D3D12_MIP_REGION SamplerFeedbackMipRegion;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_SAMPLE_DESC
    Public Count As UInteger
    Public Quality As UInteger
End Structure

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_RESOURCE_DESC1
    Public Dimension As Integer
    Public Alignment As ULong
    Public Width As ULong
    Public Height As UInteger
    Public DepthOrArraySize As UShort
    Public MipLevels As UShort
    Public Format As Integer
    Public SampleDesc As DXGI_SAMPLE_DESC
    Public Layout As Integer
    Public Flags As Integer
    Public SamplerFeedbackMipRegion As D3D12_MIP_REGION
End Structure
import ctypes
from ctypes import wintypes

class DXGI_SAMPLE_DESC(ctypes.Structure):
    _fields_ = [
        ("Count", wintypes.DWORD),
        ("Quality", wintypes.DWORD),
    ]

class D3D12_MIP_REGION(ctypes.Structure):
    _fields_ = [
        ("Width", wintypes.DWORD),
        ("Height", wintypes.DWORD),
        ("Depth", wintypes.DWORD),
    ]

class D3D12_RESOURCE_DESC1(ctypes.Structure):
    _fields_ = [
        ("Dimension", ctypes.c_int),
        ("Alignment", ctypes.c_ulonglong),
        ("Width", ctypes.c_ulonglong),
        ("Height", wintypes.DWORD),
        ("DepthOrArraySize", ctypes.c_ushort),
        ("MipLevels", ctypes.c_ushort),
        ("Format", ctypes.c_int),
        ("SampleDesc", DXGI_SAMPLE_DESC),
        ("Layout", ctypes.c_int),
        ("Flags", ctypes.c_int),
        ("SamplerFeedbackMipRegion", D3D12_MIP_REGION),
    ]
#[repr(C)]
pub struct DXGI_SAMPLE_DESC {
    pub Count: u32,
    pub Quality: u32,
}

#[repr(C)]
pub struct D3D12_MIP_REGION {
    pub Width: u32,
    pub Height: u32,
    pub Depth: u32,
}

#[repr(C)]
pub struct D3D12_RESOURCE_DESC1 {
    pub Dimension: i32,
    pub Alignment: u64,
    pub Width: u64,
    pub Height: u32,
    pub DepthOrArraySize: u16,
    pub MipLevels: u16,
    pub Format: i32,
    pub SampleDesc: DXGI_SAMPLE_DESC,
    pub Layout: i32,
    pub Flags: i32,
    pub SamplerFeedbackMipRegion: D3D12_MIP_REGION,
}
import "golang.org/x/sys/windows"

type DXGI_SAMPLE_DESC struct {
	Count uint32
	Quality uint32
}

type D3D12_MIP_REGION struct {
	Width uint32
	Height uint32
	Depth uint32
}

type D3D12_RESOURCE_DESC1 struct {
	Dimension int32
	Alignment uint64
	Width uint64
	Height uint32
	DepthOrArraySize uint16
	MipLevels uint16
	Format int32
	SampleDesc DXGI_SAMPLE_DESC
	Layout int32
	Flags int32
	SamplerFeedbackMipRegion D3D12_MIP_REGION
}
type
  DXGI_SAMPLE_DESC = record
    Count: DWORD;
    Quality: DWORD;
  end;

  D3D12_MIP_REGION = record
    Width: DWORD;
    Height: DWORD;
    Depth: DWORD;
  end;

  D3D12_RESOURCE_DESC1 = record
    Dimension: Integer;
    Alignment: UInt64;
    Width: UInt64;
    Height: DWORD;
    DepthOrArraySize: Word;
    MipLevels: Word;
    Format: Integer;
    SampleDesc: DXGI_SAMPLE_DESC;
    Layout: Integer;
    Flags: Integer;
    SamplerFeedbackMipRegion: D3D12_MIP_REGION;
  end;
const DXGI_SAMPLE_DESC = extern struct {
    Count: u32,
    Quality: u32,
};

const D3D12_MIP_REGION = extern struct {
    Width: u32,
    Height: u32,
    Depth: u32,
};

const D3D12_RESOURCE_DESC1 = extern struct {
    Dimension: i32,
    Alignment: u64,
    Width: u64,
    Height: u32,
    DepthOrArraySize: u16,
    MipLevels: u16,
    Format: i32,
    SampleDesc: DXGI_SAMPLE_DESC,
    Layout: i32,
    Flags: i32,
    SamplerFeedbackMipRegion: D3D12_MIP_REGION,
};
type
  DXGI_SAMPLE_DESC {.bycopy.} = object
    Count: uint32
    Quality: uint32

  D3D12_MIP_REGION {.bycopy.} = object
    Width: uint32
    Height: uint32
    Depth: uint32

  D3D12_RESOURCE_DESC1 {.bycopy.} = object
    Dimension: int32
    Alignment: uint64
    Width: uint64
    Height: uint32
    DepthOrArraySize: uint16
    MipLevels: uint16
    Format: int32
    SampleDesc: DXGI_SAMPLE_DESC
    Layout: int32
    Flags: int32
    SamplerFeedbackMipRegion: D3D12_MIP_REGION
struct DXGI_SAMPLE_DESC
{
    uint Count;
    uint Quality;
}

struct D3D12_MIP_REGION
{
    uint Width;
    uint Height;
    uint Depth;
}

struct D3D12_RESOURCE_DESC1
{
    int Dimension;
    ulong Alignment;
    ulong Width;
    uint Height;
    ushort DepthOrArraySize;
    ushort MipLevels;
    int Format;
    DXGI_SAMPLE_DESC SampleDesc;
    int Layout;
    int Flags;
    D3D12_MIP_REGION SamplerFeedbackMipRegion;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_RESOURCE_DESC1 サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; Dimension : D3D12_RESOURCE_DIMENSION (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Alignment : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Width : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Height : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; DepthOrArraySize : WORD (+28, 2byte)  wpoke st,28,値  /  値 = wpeek(st,28)
; MipLevels : WORD (+30, 2byte)  wpoke st,30,値  /  値 = wpeek(st,30)
; Format : DXGI_FORMAT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; SampleDesc : DXGI_SAMPLE_DESC (+36, 8byte)  varptr(st)+36 を基点に操作(8byte:入れ子/配列)
; Layout : D3D12_TEXTURE_LAYOUT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Flags : D3D12_RESOURCE_FLAGS (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; SamplerFeedbackMipRegion : D3D12_MIP_REGION (+52, 12byte)  varptr(st)+52 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DXGI_SAMPLE_DESC
    #field int Count
    #field int Quality
#endstruct

#defstruct global D3D12_MIP_REGION
    #field int Width
    #field int Height
    #field int Depth
#endstruct

#defstruct global D3D12_RESOURCE_DESC1
    #field int Dimension
    #field int64 Alignment
    #field int64 Width
    #field int Height
    #field short DepthOrArraySize
    #field short MipLevels
    #field int Format
    #field DXGI_SAMPLE_DESC SampleDesc
    #field int Layout
    #field int Flags
    #field D3D12_MIP_REGION SamplerFeedbackMipRegion
#endstruct

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