ホーム › Graphics.Direct3D10 › D3D10_TEXTURE2D_DESC
D3D10_TEXTURE2D_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Width | DWORD | 4 | +0 | +0 | テクスチャの幅(テクセル単位)。 |
| Height | DWORD | 4 | +4 | +4 | テクスチャの高さ(テクセル単位)。 |
| MipLevels | DWORD | 4 | +8 | +8 | ミップマップレベルの数。0で全レベル生成を指示する。 |
| ArraySize | DWORD | 4 | +12 | +12 | テクスチャ配列の要素数。1以上を指定する。 |
| Format | DXGI_FORMAT | 4 | +16 | +16 | テクスチャのデータフォーマット(DXGI_FORMAT)。 |
| SampleDesc | DXGI_SAMPLE_DESC | 8 | +20 | +20 | マルチサンプリングのサンプル数と品質を指定する構造体。 |
| Usage | D3D10_USAGE | 4 | +28 | +28 | テクスチャの想定使用法を示す列挙値。 |
| BindFlags | DWORD | 4 | +32 | +32 | パイプラインへのバインド方法を示すフラグの組み合わせ。 |
| CPUAccessFlags | DWORD | 4 | +36 | +36 | CPUによる読み書きアクセスの種類を示すフラグ。0も可。 |
| MiscFlags | DWORD | 4 | +40 | +40 | リソースのその他のオプションを示すフラグ。0も可。 |
各言語での定義
#include <windows.h>
// DXGI_SAMPLE_DESC (x64 8 / x86 8 バイト)
typedef struct DXGI_SAMPLE_DESC {
DWORD Count;
DWORD Quality;
} DXGI_SAMPLE_DESC;
// D3D10_TEXTURE2D_DESC (x64 44 / x86 44 バイト)
typedef struct D3D10_TEXTURE2D_DESC {
DWORD Width;
DWORD Height;
DWORD MipLevels;
DWORD ArraySize;
DXGI_FORMAT Format;
DXGI_SAMPLE_DESC SampleDesc;
D3D10_USAGE Usage;
DWORD BindFlags;
DWORD CPUAccessFlags;
DWORD MiscFlags;
} D3D10_TEXTURE2D_DESC;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 D3D10_TEXTURE2D_DESC
{
public uint Width;
public uint Height;
public uint MipLevels;
public uint ArraySize;
public int Format;
public DXGI_SAMPLE_DESC SampleDesc;
public int Usage;
public uint BindFlags;
public uint CPUAccessFlags;
public uint MiscFlags;
}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 D3D10_TEXTURE2D_DESC
Public Width As UInteger
Public Height As UInteger
Public MipLevels As UInteger
Public ArraySize As UInteger
Public Format As Integer
Public SampleDesc As DXGI_SAMPLE_DESC
Public Usage As Integer
Public BindFlags As UInteger
Public CPUAccessFlags As UInteger
Public MiscFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DXGI_SAMPLE_DESC(ctypes.Structure):
_fields_ = [
("Count", wintypes.DWORD),
("Quality", wintypes.DWORD),
]
class D3D10_TEXTURE2D_DESC(ctypes.Structure):
_fields_ = [
("Width", wintypes.DWORD),
("Height", wintypes.DWORD),
("MipLevels", wintypes.DWORD),
("ArraySize", wintypes.DWORD),
("Format", ctypes.c_int),
("SampleDesc", DXGI_SAMPLE_DESC),
("Usage", ctypes.c_int),
("BindFlags", wintypes.DWORD),
("CPUAccessFlags", wintypes.DWORD),
("MiscFlags", wintypes.DWORD),
]#[repr(C)]
pub struct DXGI_SAMPLE_DESC {
pub Count: u32,
pub Quality: u32,
}
#[repr(C)]
pub struct D3D10_TEXTURE2D_DESC {
pub Width: u32,
pub Height: u32,
pub MipLevels: u32,
pub ArraySize: u32,
pub Format: i32,
pub SampleDesc: DXGI_SAMPLE_DESC,
pub Usage: i32,
pub BindFlags: u32,
pub CPUAccessFlags: u32,
pub MiscFlags: u32,
}import "golang.org/x/sys/windows"
type DXGI_SAMPLE_DESC struct {
Count uint32
Quality uint32
}
type D3D10_TEXTURE2D_DESC struct {
Width uint32
Height uint32
MipLevels uint32
ArraySize uint32
Format int32
SampleDesc DXGI_SAMPLE_DESC
Usage int32
BindFlags uint32
CPUAccessFlags uint32
MiscFlags uint32
}type
DXGI_SAMPLE_DESC = record
Count: DWORD;
Quality: DWORD;
end;
D3D10_TEXTURE2D_DESC = record
Width: DWORD;
Height: DWORD;
MipLevels: DWORD;
ArraySize: DWORD;
Format: Integer;
SampleDesc: DXGI_SAMPLE_DESC;
Usage: Integer;
BindFlags: DWORD;
CPUAccessFlags: DWORD;
MiscFlags: DWORD;
end;const DXGI_SAMPLE_DESC = extern struct {
Count: u32,
Quality: u32,
};
const D3D10_TEXTURE2D_DESC = extern struct {
Width: u32,
Height: u32,
MipLevels: u32,
ArraySize: u32,
Format: i32,
SampleDesc: DXGI_SAMPLE_DESC,
Usage: i32,
BindFlags: u32,
CPUAccessFlags: u32,
MiscFlags: u32,
};type
DXGI_SAMPLE_DESC {.bycopy.} = object
Count: uint32
Quality: uint32
D3D10_TEXTURE2D_DESC {.bycopy.} = object
Width: uint32
Height: uint32
MipLevels: uint32
ArraySize: uint32
Format: int32
SampleDesc: DXGI_SAMPLE_DESC
Usage: int32
BindFlags: uint32
CPUAccessFlags: uint32
MiscFlags: uint32struct DXGI_SAMPLE_DESC
{
uint Count;
uint Quality;
}
struct D3D10_TEXTURE2D_DESC
{
uint Width;
uint Height;
uint MipLevels;
uint ArraySize;
int Format;
DXGI_SAMPLE_DESC SampleDesc;
int Usage;
uint BindFlags;
uint CPUAccessFlags;
uint MiscFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D10_TEXTURE2D_DESC サイズ: 44 バイト(x64)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; Width : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Height : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; MipLevels : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ArraySize : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Format : DXGI_FORMAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; SampleDesc : DXGI_SAMPLE_DESC (+20, 8byte) varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; Usage : D3D10_USAGE (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; BindFlags : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; CPUAccessFlags : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; MiscFlags : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ※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 D3D10_TEXTURE2D_DESC
#field int Width
#field int Height
#field int MipLevels
#field int ArraySize
#field int Format
#field DXGI_SAMPLE_DESC SampleDesc
#field int Usage
#field int BindFlags
#field int CPUAccessFlags
#field int MiscFlags
#endstruct
stdim st, D3D10_TEXTURE2D_DESC ; NSTRUCT 変数を確保
st->Width = 100
mes "Width=" + st->Width